OSDN Git Service

sync with UTF-8
authorkimitake <kimitake@1ca29b6e-896d-4ea0-84a5-967f57386b96>
Thu, 22 Mar 2007 09:24:07 +0000 (09:24 +0000)
committerkimitake <kimitake@1ca29b6e-896d-4ea0-84a5-967f57386b96>
Thu, 22 Mar 2007 09:24:07 +0000 (09:24 +0000)
git-svn-id: https://svn.sourceforge.jp/svnroot/nucleus-jp/nucleus-jp/trunk@241 1ca29b6e-896d-4ea0-84a5-967f57386b96

30 files changed:
euc/action.php
euc/atom.php
euc/config.php
euc/createaccount.html
euc/nucleus/libs/ACTIONS.php
euc/nucleus/libs/BAN.php
euc/nucleus/libs/BLOG.php
euc/nucleus/libs/COMMENT.php
euc/nucleus/libs/SKIN.php
euc/nucleus/libs/TEMPLATE.php
euc/nucleus/libs/skinie.php
euc/nucleus/libs/vars4.0.6.php
euc/nucleus/libs/vars4.1.0.php
euc/nucleus/libs/xmlrpc.inc.php
euc/nucleus/libs/xmlrpcs.inc.php
euc/nucleus/plugins/NP_SkinFiles.php
euc/nucleus/plugins/skinfiles/index.php
euc/nucleus/plugins/skinfiles/japanese-euc.php [new file with mode: 0644]
euc/nucleus/plugins/skinfiles/japanese-utf8.php [new file with mode: 0644]
euc/nucleus/styles/addedit.css
euc/nucleus/styles/admin.css
euc/nucleus/styles/bookmarklet.css
euc/nucleus/styles/manual.css
euc/nucleus/styles/popups.css
euc/rsd.php
euc/skins/default/default_left.css
euc/skins/default/default_right.css
euc/skins/default/head.inc
euc/skins/default/navigation.inc
euc/xml-rss2.php

index 9c1572e..e403243 100755 (executable)
@@ -1,32 +1,36 @@
 <?php
-/** 
-  * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/) 
-  * Copyright (C) 2002-2005 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...
-  *
-  * $Id: action.php,v 1.5 2007-03-22 08:07:09 kimitake Exp $
-  */
+/*
+ * 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)
+ */
+
+/**
+ * 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-2007 The Nucleus Group
+ * @version $Id: action.php,v 1.6 2007-03-22 09:23:50 kimitake Exp $
+ * $NucleusJP: action.php,v 1.7 2007/02/04 06:28:44 kimitake Exp $
+ */
 
 $CONF = array();
-include('./config.php');                       // common functions
+include('./config.php');
+
+// common functions
 include_once($DIR_LIBS . 'ACTION.php');
 
 $action = requestVar('action');
-
 $a =& new ACTION();
 $errorInfo = $a->doAction($action);
 
-if ($errorInfo)
-{
-       doError($errorInfo['message'], new SKIN($errorInfo['skinid'])); 
+if ($errorInfo) {
+       doError($errorInfo['message'], new SKIN($errorInfo['skinid']) );
 }
 
 ?>
\ No newline at end of file
index f4e9c35..9786f16 100755 (executable)
@@ -1,19 +1,24 @@
 <?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)
+ */
 
 /**
-  * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/) 
-  * Copyright (C) 2002-2005 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)
-  *
-  * Nucleus Atom Syndication
-  */
-
-header("Pragma: no-cache");
+ * Nucleus Atom Syndication
+ * @license http://nucleuscms.org/license.txt GNU General Public License
+ * @copyright Copyright (C) 2002-2007 The Nucleus Group
+ * @version $Id: atom.php,v 1.6 2007-03-22 09:23:50 kimitake Exp $
+ * $NucleusJP: atom.php,v 1.7 2007/02/04 06:28:44 kimitake Exp $
+ */
+
+header('Pragma: no-cache');
 
 $CONF = array();
 $CONF['Self'] = 'atom.php';
@@ -25,17 +30,17 @@ if (!$CONF['DisableSite']) {
        ob_start();
                selectSkin('feeds/atom');
                selector();
-       $feed = ob_get_contents();
+               $feed = ob_get_contents();
        ob_end_clean();
-       
+
        // create ETAG (hash of feed)
        // (HTTP_IF_NONE_MATCH has quotes around it)
-       $eTag = '"'.md5($feed).'"';
-       header('Etag: '.$eTag);
-       
+       $eTag = '"' . md5($feed) . '"';
+       header('Etag: ' . $eTag);
+
        // compare Etag to what we got
-       if ($eTag == serverVar('HTTP_IF_NONE_MATCH')) { 
-               header("HTTP/1.0 304 Not Modified");
+       if ($eTag == serverVar('HTTP_IF_NONE_MATCH') ) {
+               header('HTTP/1.0 304 Not Modified');
                header('Content-Length: 0');
        } else {
                $feed = mb_convert_encoding($feed, "UTF-8", "EUC-JP");
@@ -43,7 +48,7 @@ if (!$CONF['DisableSite']) {
                // dump feed
                echo $feed;
        }
-               
+
 }
 
-?>
+?>
\ No newline at end of file
index f21b3ec..300d9db 100755 (executable)
@@ -1,38 +1,38 @@
-<?php\r
-\r
-// This file contains variables with the locations of the data dirs\r
-// and basic functions that every page can use\r
-\r
-// mySQL connection information\r
-$MYSQL_HOST = 'hostname';\r
-$MYSQL_USER = 'username';\r
-$MYSQL_PASSWORD = 'password';\r
-$MYSQL_DATABASE = 'databasename';\r
-$MYSQL_PREFIX = '';\r
-\r
-// main nucleus directory\r
-$DIR_NUCLEUS = '/your/path/to/nucleus/';\r
-\r
-// media dir\r
-$DIR_MEDIA = '/your/path/to/media/';\r
-\r
-// extra skin files for imported skins\r
-$DIR_SKINS = '/your/path/to/skins/';\r
-\r
-// these dirs are normally subdirs of the nucleus dir, but\r
-// you can redefine them if you wish\r
-$DIR_PLUGINS = $DIR_NUCLEUS . 'plugins/';\r
-$DIR_LANG = $DIR_NUCLEUS . 'language/';\r
-$DIR_LIBS = $DIR_NUCLEUS . 'libs/';\r
-\r
-if (!@file_exists($DIR_LIBS . 'globalfunctions.php')) {\r
-       echo "Configuration error, please run the install script or modify config.php";\r
-       exit;\r
-}\r
-\r
-// include libs\r
-include($DIR_LIBS.'globalfunctions.php');\r
-if (!extension_loaded('mbstring')) {\r
-include($DIR_LIBS.'mb_emulator/mb-emulator.php');\r
-}\r
+<?php
+
+// This file contains variables with the locations of the data dirs
+// and basic functions that every page can use
+
+// mySQL connection information
+$MYSQL_HOST = 'hostname';
+$MYSQL_USER = 'username';
+$MYSQL_PASSWORD = 'password';
+$MYSQL_DATABASE = 'databasename';
+$MYSQL_PREFIX = '';
+
+// main nucleus directory
+$DIR_NUCLEUS = '/your/path/to/nucleus/';
+
+// media dir
+$DIR_MEDIA = '/your/path/to/media/';
+
+// extra skin files for imported skins
+$DIR_SKINS = '/your/path/to/skins/';
+
+// these dirs are normally subdirs of the nucleus dir, but
+// you can redefine them if you wish
+$DIR_PLUGINS = $DIR_NUCLEUS . 'plugins/';
+$DIR_LANG = $DIR_NUCLEUS . 'language/';
+$DIR_LIBS = $DIR_NUCLEUS . 'libs/';
+
+if (!@file_exists($DIR_LIBS . 'globalfunctions.php')) {
+       echo "Configuration error, please run the install script or modify config.php";
+       exit;
+}
+
+// include libs
+include($DIR_LIBS.'globalfunctions.php');
+if (!extension_loaded('mbstring')) {
+       include($DIR_LIBS.'mb_emulator/mb-emulator.php');
+}
 ?>
\ No newline at end of file
index 9ca959b..a5575da 100755 (executable)
@@ -37,4 +37,4 @@
 
        </form>
 </body>
-</html>
+</html>
\ No newline at end of file
index d54ada3..cdb3624 100644 (file)
@@ -18,8 +18,8 @@
  *
  * @license http://nucleuscms.org/license.txt GNU General Public License
  * @copyright Copyright (C) 2002-2007 The Nucleus Group
- * @version $Id: ACTIONS.php,v 1.1 2007-03-22 08:36:52 kimitake Exp $
- * @version $NucleusJP: ACTIONS.php,v 1.6 2007/03/13 05:17:37 shizuki Exp $
+ * @version $Id: ACTIONS.php,v 1.2 2007-03-22 09:23:58 kimitake Exp $
+ * @version $NucleusJP: ACTIONS.php,v 1.1 2007/03/22 08:36:52 kimitake Exp $
  */
 
 class ACTIONS extends BaseActions {
@@ -389,7 +389,7 @@ class ACTIONS extends BaseActions {
        function parse_additemform() {
                global $blog, $CONF;
                $this->formdata = array(
-                       'adminurl' => htmlspecialchars($CONF['AdminURL']),
+                       'adminurl' => htmlspecialchars($CONF['AdminURL'],ENT_QUOTES),
                        'catid' => $blog->getDefaultCategory()
                );
                $blog->InsertJavaScriptInfo();
@@ -518,19 +518,19 @@ class ACTIONS extends BaseActions {
                global $blog;
                switch($which) {
                        case 'id':
-                               echo htmlspecialchars($blog->getID());
+                               echo htmlspecialchars($blog->getID(),ENT_QUOTES);
                                break;
                        case 'url':
-                               echo htmlspecialchars($blog->getURL());
+                               echo htmlspecialchars($blog->getURL(),ENT_QUOTES);
                                break;
                        case 'name':
-                               echo htmlspecialchars($blog->getName());
+                               echo htmlspecialchars($blog->getName(),ENT_QUOTES);
                                break;
                        case 'desc':
-                               echo htmlspecialchars($blog->getDescription());
+                               echo htmlspecialchars($blog->getDescription(),ENT_QUOTES);
                                break;
                        case 'short':
-                               echo htmlspecialchars($blog->getShortName());
+                               echo htmlspecialchars($blog->getShortName(),ENT_QUOTES);
                                break;
                }
        }
@@ -627,7 +627,7 @@ class ACTIONS extends BaseActions {
                        // note: createLink returns an HTML encoded URL
                } else {
                        // HTML encode URL
-                       $destinationurl = htmlspecialchars($destinationurl);
+                       $destinationurl = htmlspecialchars($destinationurl,ENT_QUOTES);
                }
 
                // values to prefill
@@ -643,12 +643,12 @@ class ACTIONS extends BaseActions {
 
                $this->formdata = array(
                        'destinationurl' => $destinationurl,    // url is already HTML encoded
-                       'actionurl' => htmlspecialchars($actionurl),
+                       'actionurl' => htmlspecialchars($actionurl,ENT_QUOTES),
                        'itemid' => $itemid,
-                       'user' => htmlspecialchars($user),
-                       'userid' => htmlspecialchars($userid),
-                       'email' => htmlspecialchars($email),
-                       'body' => htmlspecialchars($body),
+                       'user' => htmlspecialchars($user,ENT_QUOTES),
+                       'userid' => htmlspecialchars($userid,ENT_QUOTES),
+                       'email' => htmlspecialchars($email,ENT_QUOTES),
+                       'body' => htmlspecialchars($body,ENT_QUOTES),
                        'membername' => $member->getDisplayName(),
                        'rememberchecked' => cookieVar($CONF['CookiePrefix'] .'comment_user')?'checked="checked"':''
                );
@@ -758,7 +758,7 @@ class ACTIONS extends BaseActions {
         * Parse skinvar imagetext
         */
        function parse_imagetext() {
-               echo htmlspecialchars(requestVar('imagetext'));
+               echo htmlspecialchars(requestVar('imagetext'),ENT_QUOTES);
        }
 
        /**
@@ -809,7 +809,7 @@ class ACTIONS extends BaseActions {
                                echo $item['title'];
                                break;
                        default:
-                               echo htmlspecialchars(strip_tags($item['title']));
+                               echo htmlspecialchars(strip_tags($item['title']),ENT_QUOTES);
                                break;
                }
        }
@@ -843,22 +843,22 @@ class ACTIONS extends BaseActions {
 
                        switch($what) {
                                case 'name':
-                                       echo htmlspecialchars($memberinfo->getDisplayName());
+                                       echo htmlspecialchars($memberinfo->getDisplayName(),ENT_QUOTES);
                                        break;
                                case 'realname':
-                                       echo htmlspecialchars($memberinfo->getRealName());
+                                       echo htmlspecialchars($memberinfo->getRealName(),ENT_QUOTES);
                                        break;
                                case 'notes':
-                                       echo htmlspecialchars($memberinfo->getNotes());
+                                       echo htmlspecialchars($memberinfo->getNotes(),ENT_QUOTES);
                                        break;
                                case 'url':
-                                       echo htmlspecialchars($memberinfo->getURL());
+                                       echo htmlspecialchars($memberinfo->getURL(),ENT_QUOTES);
                                        break;
                                case 'email':
-                                       echo htmlspecialchars($memberinfo->getEmail());
+                                       echo htmlspecialchars($memberinfo->getEmail(),ENT_QUOTES);
                                        break;
                                case 'id':
-                                       echo htmlspecialchars($memberinfo->getID());
+                                       echo htmlspecialchars($memberinfo->getID(),ENT_QUOTES);
                                        break;
                        }
                }
@@ -908,12 +908,12 @@ class ACTIONS extends BaseActions {
 
                $this->formdata = array(
                        'url' => htmlspecialchars($desturl),
-                       'actionurl' => htmlspecialchars($CONF['ActionURL']),
+                       'actionurl' => htmlspecialchars($CONF['ActionURL'],ENT_QUOTES),
                        'memberid' => $memberid,
                        'rows' => $rows,
                        'cols' => $cols,
-                       'message' => htmlspecialchars($message),
-                       'frommail' => htmlspecialchars($frommail)
+                       'message' => htmlspecialchars($message,ENT_QUOTES),
+                       'frommail' => htmlspecialchars($frommail,ENT_QUOTES)
                );
                if ($member->isLoggedIn()) {
                        $this->doForm('membermailform-loggedin');
@@ -939,7 +939,7 @@ class ACTIONS extends BaseActions {
         */      
        function parse_nextitem() {
                global $itemidnext;
-               echo $itemidnext;
+               if (isset($itemidnext)) echo (int)$itemidnext;
        }
 
        /**
@@ -960,7 +960,7 @@ class ACTIONS extends BaseActions {
                                echo $itemtitlenext;
                                break;
                        default:
-                               echo htmlspecialchars($itemtitlenext);
+                               echo htmlspecialchars($itemtitlenext,ENT_QUOTES);
                                break;
                }
        }
@@ -1126,7 +1126,7 @@ class ACTIONS extends BaseActions {
         */       
        function parse_previtem() {
                global $itemidprev;
-               echo $itemidprev;
+               if (isset($itemidprev)) echo (int)$itemidprev;
        }
 
        /**
@@ -1147,7 +1147,7 @@ class ACTIONS extends BaseActions {
                                echo $itemtitleprev;
                                break;
                        default:
-                               echo htmlspecialchars($itemtitleprev);
+                               echo htmlspecialchars($itemtitleprev,ENT_QUOTES);
                                break;
                }
        }
@@ -1172,14 +1172,14 @@ class ACTIONS extends BaseActions {
         */     
        function parse_query() {
                global $query;
-               echo htmlspecialchars($query);
+               echo htmlspecialchars($query,ENT_QUOTES);
        }
 
        /**
         * Parse skinvar referer
         */
        function parse_referer() {
-               echo htmlspecialchars(serverVar('HTTP_REFERER'));
+               echo htmlspecialchars(serverVar('HTTP_REFERER'),ENT_QUOTES);
        }
 
        /**
@@ -1195,7 +1195,7 @@ class ACTIONS extends BaseActions {
                // use default blog when no blog is selected
                $this->formdata = array(
                        'id' => $blog?$blog->getID():$CONF['DefaultBlog'],
-                       'query' => htmlspecialchars(getVar('query')),
+                       'query' => htmlspecialchars(getVar('query'),ENT_QUOTES),
                );
                $this->doForm('searchform');
        }
index f1cd322..343b97d 100755 (executable)
-<?php\r
-/**\r
-  * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/) \r
-  * Copyright (C) 2002-2005 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
-  * PHP class responsible for ban-management. \r
-  *\r
-  * $Id: BAN.php,v 1.3 2005-03-16 08:10:35 kimitake Exp $\r
-  * $NucleusJP: BAN.php,v 1.3 2005/03/12 06:19:05 kimitake Exp $\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
-       function isBanned($blogid, $ip) {\r
-               $blogid = intval($blogid);\r
-               $query = 'SELECT * FROM '.sql_table('ban').' WHERE blogid='.$blogid;\r
-               $res = sql_query($query);\r
-               while ($obj = mysql_fetch_object($res)) {\r
-                       $found = strpos ($ip, $obj->iprange);\r
-                       if (!($found === false)) \r
-                               // found a match!\r
-                               return new BANINFO($obj->iprange, $obj->reason);\r
-               }\r
-               return 0;\r
-       }\r
-       \r
-       /**\r
-         * Adds a new ban to the banlist. Returns 1 on success, 0 on error\r
-         */\r
-       function addBan($blogid, $iprange, $reason) {\r
-               global $manager;\r
-               \r
-               $blogid = intval($blogid);\r
-       \r
-               $manager->notify(\r
-                       'PreAddBan',\r
-                       array(\r
-                               'blogid' => $blogid,\r
-                               'iprange' => &$iprange,\r
-                               'reason' => &$reason\r
-                       )\r
-               );\r
-       \r
-               $query = 'INSERT INTO '.sql_table('ban')." (blogid, iprange, reason) VALUES "\r
-                      . "($blogid,'".addslashes($iprange)."','".addslashes($reason)."')";\r
-               $res = sql_query($query);\r
-               \r
-               $manager->notify(\r
-                       'PostAddBan',\r
-                       array(\r
-                               'blogid' => $blogid,\r
-                               'iprange' => $iprange,\r
-                               'reason' => $reason\r
-                       )\r
-               );\r
-               \r
-               return $res ? 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
-       function removeBan($blogid, $iprange) {\r
-               global $manager;\r
-               $blogid = intval($blogid);\r
-               \r
-               $manager->notify('PreDeleteBan', array('blogid' => $blogid, 'range' => $iprange));\r
-               \r
-               $query = 'DELETE FROM '.sql_table('ban')." WHERE blogid=$blogid and iprange='" .addslashes($iprange). "'";\r
-               sql_query($query);\r
-               \r
-               $result = (mysql_affected_rows() > 0);\r
-               \r
-               $manager->notify('PostDeleteBan', array('blogid' => $blogid, 'range' => $iprange));\r
-               \r
-               return $result;\r
-       }\r
-}\r
-\r
-class BANINFO {\r
-       var $iprange;\r
-       var $message;\r
-       \r
-       function BANINFO($iprange, $message) {\r
-               $this->iprange = $iprange;\r
-               $this->message = $message;\r
-       }\r
-}\r
-\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)
+ */
+/**
+ * PHP class responsible for ban-management.
+ *
+ * @license http://nucleuscms.org/license.txt GNU General Public License
+ * @copyright Copyright (C) 2002-2007 The Nucleus Group
+ * @version $Id: BAN.php,v 1.4 2007-03-22 09:23:58 kimitake Exp $
+ * $NucleusJP: BAN.php,v 1.7 2007/02/04 06:28:46 kimitake Exp $
+ */
+
+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
+         */
+       function isBanned($blogid, $ip) {
+               $blogid = intval($blogid);
+               $query = 'SELECT * FROM '.sql_table('ban').' WHERE blogid='.$blogid;
+               $res = sql_query($query);
+               while ($obj = mysql_fetch_object($res)) {
+                       $found = strpos ($ip, $obj->iprange);
+                       if (!($found === false))
+                               // found a match!
+                                       return new BANINFO($obj->iprange, $obj->reason);
+               }
+               return 0;
+       }
+
+       /**
+         * Adds a new ban to the banlist. Returns 1 on success, 0 on error
+         */
+       function addBan($blogid, $iprange, $reason) {
+               global $manager;
+
+               $blogid = intval($blogid);
+
+               $manager->notify(
+                       'PreAddBan',
+                       array(
+                               'blogid' => $blogid,
+                               'iprange' => &$iprange,
+                               'reason' => &$reason
+                       )
+               );
+
+               $query = 'INSERT INTO '.sql_table('ban')." (blogid, iprange, reason) VALUES "
+                          . "($blogid,'".addslashes($iprange)."','".addslashes($reason)."')";
+               $res = sql_query($query);
+
+               $manager->notify(
+                       'PostAddBan',
+                       array(
+                               'blogid' => $blogid,
+                               'iprange' => $iprange,
+                               'reason' => $reason
+                       )
+               );
+
+               return $res ? 1 : 0;
+       }
+
+       /**
+         * Removes a ban from the banlist (correct iprange is needed as argument)
+         * Returns 1 on success, 0 on error
+         */
+       function removeBan($blogid, $iprange) {
+               global $manager;
+               $blogid = intval($blogid);
+
+               $manager->notify('PreDeleteBan', array('blogid' => $blogid, 'range' => $iprange));
+
+               $query = 'DELETE FROM '.sql_table('ban')." WHERE blogid=$blogid and iprange='" .addslashes($iprange). "'";
+               sql_query($query);
+
+               $result = (mysql_affected_rows() > 0);
+
+               $manager->notify('PostDeleteBan', array('blogid' => $blogid, 'range' => $iprange));
+
+               return $result;
+       }
+}
+
+class BANINFO {
+       var $iprange;
+       var $message;
+
+       function BANINFO($iprange, $message) {
+               $this->iprange = $iprange;
+               $this->message = $message;
+       }
+}
+
+
+?>
\ No newline at end of file
index 27ae0b5..44bdc7d 100755 (executable)
-<?php\r
-\r
-/**\r
-  * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/) \r
-  * Copyright (C) 2002-2005 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
-  * A class representing a blog and containing functions to get that blog shown\r
-  * on the screen \r
-  *\r
-  * $Id: BLOG.php,v 1.3 2005-03-16 08:10:35 kimitake Exp $\r
-  * $NucleusJP: BLOG.php,v 1.3 2005/03/12 06:19:05 kimitake Exp $\r
-  */\r
-class BLOG {\r
-       \r
-       // blog id\r
-       var $blogid;\r
-       \r
-       // ID of currently selected category\r
-       var $selectedcatid;\r
-       \r
-       // After creating an object of the blog class, contains true if the BLOG object is \r
-       // valid (the blog exists)\r
-       var $isValid;\r
-       \r
-       // associative array, containing all blogsettings (use the get/set functions instead)\r
-       var $settings;\r
-       \r
-       /**\r
-        * Creates a new BLOG object for the given blog\r
-        *\r
-        * @param $id blogid\r
-        */\r
-       function BLOG($id) {\r
-               $this->blogid = intval($id);\r
-               $this->readSettings();\r
-\r
-               // try to set catid \r
-               // (the parse functions in SKIN.php will override this, so it's mainly useless)\r
-               global $catid;\r
-               $this->setSelectedCategory($catid);\r
-       }\r
-\r
-       /**\r
-        * Shows the given amount of items for this blog\r
-        *\r
-        * @param $template\r
-        *              String representing the template _NAME_ (!)\r
-        * @param $amountEntries \r
-        *              amount of entries to show\r
-        * @param $startpos\r
-        *              offset from where items should be shown (e.g. 5 = start at fifth item)\r
-        * @returns int\r
-        *              amount of items shown\r
-        */\r
-       function readLog($template, $amountEntries, $offset = 0, $startpos = 0) {\r
-               return $this->readLogAmount($template,$amountEntries,'','',1,1,$offset, $startpos);\r
-       }\r
-\r
-       /**\r
-        * Shows an archive for a given month\r
-        *\r
-        * @param $year\r
-        *              year\r
-        * @param $month\r
-        *              month \r
-        * @param $template\r
-        *              String representing the template name to be used\r
-        */\r
-       function showArchive($templatename, $year, $month, $day=0) {\r
-               \r
-               // create extra where clause for select query\r
-               if ($day == 0) {\r
-                       $timestamp_start = mktime(0,0,0,$month,1,$year);\r
-                       $timestamp_end = mktime(0,0,0,$month+1,1,$year);  // also works when $month==12\r
-               } else {\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>=' . mysqldate($timestamp_start)\r
-                            . ' and i.itime<' . mysqldate($timestamp_end);\r
-               \r
-       \r
-               $this->readLogAmount($templatename,0,$extra_query,'',1,1);\r
-\r
-       }\r
-\r
-\r
-       // sets/gets current category (only when category exists)\r
-       function setSelectedCategory($catid) {\r
-               if ($this->isValidCategory($catid) || (intval($catid) == 0)) \r
-                       $this->selectedcatid = intval($catid);\r
-       }\r
-       \r
-       function setSelectedCategoryByName($catname) {\r
-               $this->setSelectedCategory($this->getCategoryIdFromName($catname));\r
-       }\r
-\r
-       function getSelectedCategory() { \r
-               return $this->selectedcatid; \r
-       }\r
-\r
-       /**\r
-        * Shows the given amount of items for this blog\r
-        *\r
-        * @param $template\r
-        *              String representing the template _NAME_ (!)\r
-        * @param $amountEntries\r
-        *              amount of entries to show (0 = no limit)\r
-        * @param $extraQuery\r
-        *              extra conditions to be added to the query\r
-        * @param $highlight\r
-        *              contains a query that should be highlighted\r
-        * @param $comments\r
-        *              1=show comments 0=don't show comments\r
-        * @param $dateheads\r
-        *              1=show dateheads 0=don't show dateheads\r
-        * @param $offset\r
-        *              offset\r
-        * @returns int\r
-        *              amount of items shown\r
-        */\r
-       function readLogAmount($template, $amountEntries, $extraQuery, $highlight, $comments, $dateheads, $offset = 0, $startpos = 0) {\r
-\r
-               $query = $this->getSqlBlog($extraQuery);\r
-               \r
-               if ($amountEntries > 0) {\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
-       function showUsingQuery($templateName, $query, $highlight = '', $comments = 0, $dateheads = 1) {\r
-               global $CONF, $manager;\r
-\r
-               $lastVisit = cookieVar($CONF['CookiePrefix'] .'lastVisit');\r
-               if ($lastVisit != 0)\r
-                       $lastVisit = $this->getCorrectTime($lastVisit);\r
-\r
-               // set templatename as global variable (so plugins can access it)\r
-               global $currentTemplateName;\r
-               $currentTemplateName = $templateName;\r
-               \r
-               $template =& $manager->getTemplate($templateName);\r
-               \r
-               // create parser object & action handler\r
-               $actions =& new ITEMACTIONS($this);\r
-               $parser =& new PARSER($actions->getDefinedActions(),$actions);\r
-               $actions->setTemplate($template);\r
-               $actions->setHighlight($highlight);\r
-               $actions->setLastVisit($lastVisit);\r
-               $actions->setParser($parser);\r
-               $actions->setShowComments($comments);\r
-\r
-               // execute query\r
-               $items = sql_query($query);\r
-               \r
-               // loop over all items\r
-               while ($item = mysql_fetch_object($items)) {\r
-                       \r
-                       $item->timestamp = strtotime($item->itime);     // string timestamp -> unix timestamp\r
-               \r
-                       // action handler needs to know the item we're handling\r
-                       $actions->setCurrentItem($item);\r
-                       \r
-                       // add date header if needed\r
-                       if ($dateheads) {\r
-                               $new_date = date('dFY',$item->timestamp);\r
-                               if ($new_date != $old_date) {\r
-                                       // unless this is the first time, write date footer\r
-                                       $timestamp = $item->timestamp;\r
-                                       if ($old_date != 0) {\r
-                                               $oldTS = strtotime($old_date);\r
-                                               $manager->notify('PreDateFoot',array('blog' => &$this, 'timestamp' => $oldTS));\r
-                                               $parser->parse(strftime($template['DATE_FOOTER'], $oldTS));\r
-                                               $manager->notify('PostDateFoot',array('blog' => &$this, 'timestamp' => $oldTS));                                                \r
-                                       }\r
-                                       $manager->notify('PreDateHead',array('blog' => &$this, 'timestamp' => $timestamp));\r
-                                       // note, to use templatvars in the dateheader, the %-characters need to be doubled in\r
-                                       // order to be preserved by strftime\r
-                                       $parser->parse(strftime($template['DATE_HEADER'],$timestamp));\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
-               \r
-               $numrows = mysql_num_rows($items);\r
-               \r
-               // add another date footer if there was at least one item\r
-               if (($numrows > 0) && $dateheads) {\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
-               mysql_free_result($items);      // free memory\r
-               \r
-               return $numrows;\r
-               \r
-       }        \r
-       \r
-       function showOneitem($itemid, $template, $highlight) {\r
-               $extraQuery = ' and inumber=' . intval($itemid);\r
-               \r
-               return $this->readLogAmount($template, 1, $extraQuery, $highlight, 0, 0);\r
-       }\r
-       \r
-\r
-       /**\r
-         * Adds an item to this blog\r
-         */\r
-       function additem($catid, $title, $body, $more, $blogid, $authorid, $timestamp, $closed, $draft) {\r
-               global $manager;\r
-\r
-               $blogid         = intval($blogid);\r
-               $authorid       = intval($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
-                       $body = addBreaks($body);\r
-                       $more = addBreaks($more);\r
-               }\r
-               \r
-               if ($closed != '1')     $closed = '0';\r
-               if ($draft != '0') $draft = '1';\r
-\r
-               if (!$this->isValidCategory($catid))\r
-                       $catid = $this->getDefaultCategory();\r
-               \r
-               if ($timestamp > $this->getCorrectTime())\r
-                       $isFuture = 1;\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
-               $title = addslashes($title);\r
-               $body = addslashes($body);\r
-               $more = addslashes($more);\r
-\r
-               $query = 'INSERT INTO '.sql_table('item').' (ITITLE, IBODY, IMORE, IBLOG, IAUTHOR, ITIME, ICLOSED, IDRAFT, ICAT) '\r
-                      . "VALUES ('$title', '$body', '$more', $blogid, $authorid, '$timestamp', $closed, $draft, $catid)";\r
-               sql_query($query);  \r
-               $itemid = mysql_insert_id();\r
-               \r
-               $manager->notify('PostAddItem',array('itemid' => $itemid));\r
-               \r
-               if (!$draft) \r
-                       $this->updateUpdateFile();\r
-               \r
-               // send notification mail\r
-               if (!$draft && !$isFuture && $this->getNotifyAddress() && $this->notifyOnNewItem()) \r
-                       $this->sendNewItemNotification($itemid, stripslashes($title), stripslashes($body));\r
-               \r
-               return $itemid;\r
-       }\r
-       \r
-       function sendNewItemNotification($itemid, $title, $body) {\r
-               global $CONF, $member;\r
-               \r
-               // create text version of html post\r
-               $ascii = toAscii($body);\r
-\r
-               $mailto_msg = _NOTIFY_NI_MSG . " \n";\r
-               $mailto_msg .= $CONF['IndexURL'] . 'index.php?itemid=' . $itemid . "\n\n";\r
-               $mailto_msg .= _NOTIFY_TITLE . ' ' . strip_tags($title) . "\n";\r
-               $mailto_msg .= _NOTIFY_CONTENTS . "\n " . $ascii . "\n";\r
-               $mailto_msg .= getMailFooter();\r
-               \r
-               $mailto_title = $this->getName() . ': ' . _NOTIFY_NI_TITLE;\r
-                       \r
-               $frommail = $member->getNotifyFromMailAddress();\r
-\r
-               $notify =& new NOTIFICATION($this->getNotifyAddress());\r
-               $notify->notify($mailto_title, $mailto_msg , $frommail);\r
-                               \r
-\r
-\r
-       }\r
-\r
-       \r
-       /**\r
-         * Creates a new category for this blog\r
-         *\r
-         * @param $catName\r
-         *             name of the new category. When empty, a name is generated automatically \r
-         *             (starting with newcat)\r
-         * @param $catDescription\r
-         *             description of the new category. Defaults to 'New Category'\r
-         *\r
-         * @returns \r
-         *             the new category-id in case of success. \r
-         *             0 on failure\r
-         */\r
-       function createNewCategory($catName = '', $catDescription = 'New category') {\r
-               global $member, $manager;\r
-\r
-               if ($member->blogAdminRights($this->getID())) {\r
-                       // generate \r
-                       if ($catName == '')\r
-                       {\r
-                               $catName = 'newcat';\r
-                               $i = 1;\r
-                               while(mysql_num_rows(sql_query('SELECT * FROM '.sql_table('category')." WHERE cname='".$catName.$i."' and cblog=".$this->getID())) > 0) \r
-                                       $i++;\r
-                               $catName = $catName . $i;\r
-                       }\r
-                       \r
-                       $manager->notify(\r
-                               'PreAddCategory',\r
-                               array(\r
-                                       'blog' => &$this,\r
-                                       'name' => &$catName,\r
-                                       'description' => $catDescription\r
-                               )\r
-                       );\r
-                       \r
-                       $query = 'INSERT INTO '.sql_table('category').' (cblog, cname, cdesc) VALUES (' . $this->getID() . ", '" . addslashes($catName) . "', '" . addslashes($catDescription) . "')";\r
-                       sql_query($query);\r
-                       $catid = mysql_insert_id();\r
-                       \r
-                       $manager->notify(\r
-                               'PostAddCategory',\r
-                               array(\r
-                                       'blog' => &$this,\r
-                                       'name' => $catName,\r
-                                       'description' => $catDescription,\r
-                                       'catid' => $catid\r
-                               )\r
-                       );                      \r
-                       \r
-                       return $catid;\r
-               } else {\r
-                       return 0;\r
-               }\r
-       \r
-       }       \r
-\r
-\r
-       /**\r
-        * Searches all months of this blog for the given query\r
-        *\r
-        * @param $query\r
-        *              search query\r
-        * @param $template\r
-        *              template to be used (__NAME__ of the template)\r
-        * @param $amountMonths\r
-        *              max amount of months to be search (0 = all)\r
-        * @param $maxresults\r
-        *              max number of results to show\r
-        * @param $startpos\r
-        *              offset\r
-        * @returns\r
-        *              amount of hits found\r
-        */\r
-       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
-               } else {\r
-               \r
-                       // add LIMIT to query (to split search results into pages)\r
-            if (intval($maxresults > 0)) \r
-                   $sqlquery .= ' LIMIT ' . intval($startpos).',' . intval($maxresults);\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'         => htmlspecialchars($query),\r
-                               'blogid'        => $this->getID()\r
-                       );\r
-                       echo TEMPLATE::fill($template['SEARCH_NOTHINGFOUND'],$vars);\r
-               }\r
-        }\r
-        \r
-               return $amountfound;\r
-       }\r
-       \r
-       /**\r
-        * Returns an SQL query to use for a search query\r
-        *\r
-        * @param $query\r
-        *              search query\r
-        * @param $amountMonths\r
-        *              amount of months to search back. Default = 0 = unlimited\r
-        * @param $mode\r
-        *              either empty, or 'count'. In this case, the query will be a SELECT COUNT(*) query\r
-        * @returns $highlight\r
-        *              words to highlight (out parameter)\r
-        * @returns \r
-        *              either a full SQL query, or an empty string (if querystring empty)\r
-        * @note\r
-        *              No LIMIT clause is added. (caller should add this if multiple pages are requested)\r
-        */\r
-       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
-               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->getID();                       // also search current blog (duh)\r
-               $blogs          = array_unique($blogs);         // remove duplicates\r
-               $selectblogs = '';\r
-               if (count($blogs) > 0)\r
-                       $selectblogs = ' and i.iblog in (' . implode(',', $blogs) . ')';\r
-\r
-               if ($mode == '') \r
-               {\r
-                       $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';\r
-                       if ($select) \r
-                               $query .= ', '.$select. ' as score ';\r
-               } else {\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
-                          . ' and i.idraft=0'  // exclude drafts\r
-                          . $selectblogs\r
-                                       // don't show future items\r
-                          . ' and i.itime<=' . mysqldate($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>' . mysqldate($timestamp_start);\r
-               }\r
-\r
-               if ($mode == '')\r
-               {\r
-                       if ($select) \r
-                               $query .= ' ORDER BY score DESC';\r
-                       else \r
-                               $query .= ' ORDER BY i.itime DESC ';\r
-               }\r
-\r
-               return $query;          \r
-       }\r
-       \r
-       /**\r
-        * Returns the SQL query that's normally used to display the blog items on the index type skins\r
-        *\r
-        * @param $mode\r
-        *              either empty, or 'count'. In this case, the query will be a SELECT COUNT(*) query\r
-        * @returns \r
-        *              either a full SQL query, or an empty string \r
-        * @note\r
-        *              No LIMIT clause is added. (caller should add this if multiple pages are requested)\r
-        */\r
-       function getSqlBlog($extraQuery, $mode = '')\r
-       {\r
-               if ($mode == '')\r
-                       $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';\r
-               else\r
-                       $query = 'SELECT COUNT(*) as result ';\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
-                                       // don't show future items\r
-                      . ' and i.itime<=' . mysqldate($this->getCorrectTime());\r
-\r
-               if ($this->getSelectedCategory())\r
-                       $query .= ' and i.icat=' . $this->getSelectedCategory() . ' ';\r
-\r
-\r
-               $query .= $extraQuery;\r
-               \r
-               if ($mode == '')\r
-                       $query .= ' ORDER BY i.itime DESC';\r
-                      \r
-               return $query;\r
-       }\r
-\r
-       /**\r
-         * Shows the archivelist using the given template\r
-         */\r
-       function showArchiveList($template, $mode = 'month', $limit = 0) {\r
-               global $CONF, $catid, $manager;\r
-\r
-               if ($catid) \r
-                       $linkparams = array('catid' => $catid);\r
-               \r
-               $template =& $manager->getTemplate($template);\r
-               $data['blogid'] = $this->getID();\r
-\r
-               echo TEMPLATE::fill($template['ARCHIVELIST_HEADER'],$data);\r
-\r
-               $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')\r
-               . ' WHERE iblog=' . $this->getID()\r
-               . ' and itime <=' . mysqldate($this->getCorrectTime())  // don't show future items!\r
-               . ' and idraft=0'; // don't show draft items\r
-               \r
-               if ($catid)\r
-                       $query .= ' and icat=' . intval($catid);\r
-               \r
-               $query .= ' GROUP BY Year, Month';\r
-               if ($mode == 'day')\r
-                       $query .= ', Day';\r
-               \r
-                       \r
-               $query .= ' ORDER BY itime DESC';                               \r
-               \r
-               if ($limit > 0) \r
-                       $query .= ' LIMIT ' . intval($limit);\r
-               \r
-               $res = sql_query($query);\r
-\r
-               while ($current = mysql_fetch_object($res)) {\r
-                       $current->itime = strtotime($current->itime);   // string time -> unix timestamp\r
-               \r
-                       if ($mode == 'day') {\r
-                               $archivedate = date('Y-m-d',$current->itime);\r
-                               $archive['day'] = date('d',$current->itime);\r
-                       } else {\r
-                               $archivedate = date('Y-m',$current->itime);                     \r
-                       }\r
-                       $data['month'] = date('m',$current->itime);\r
-                       $data['year'] = date('Y',$current->itime);\r
-                       $data['archivelink'] = createArchiveLink($this->getID(),$archivedate,$linkparams);\r
-\r
-                       $temp = TEMPLATE::fill($template['ARCHIVELIST_LISTITEM'],$data);\r
-                       echo strftime($temp,$current->itime);\r
-\r
-               }\r
-               \r
-               mysql_free_result($res);\r
-\r
-               echo TEMPLATE::fill($template['ARCHIVELIST_FOOTER'],$data);\r
-       }\r
-       \r
-\r
-       /**\r
-         * Shows the list of categories using a given template\r
-         */\r
-       function showCategoryList($template) {\r
-               global $CONF, $manager;\r
-               \r
-               // determine arguments next to catids\r
-               // I guess this can be done in a better way, but it works\r
-               global $archive, $archivelist;\r
-               \r
-               $linkparams = array();\r
-               if ($archive) {\r
-                       $blogurl = createArchiveLink($this->getID(), $archive, '');\r
-                       $linkparams['blogid'] = $this->getID();\r
-                       $linkparams['archive'] = $archive;\r
-               } else if ($archivelist) {\r
-                       $blogurl = createArchiveListLink($this->getID(), '');\r
-                       $linkparams['archivelist'] = $archivelist;\r
-               } else {\r
-                       $blogurl = createBlogidLink($this->getID(), '');\r
-                       $linkparams['blogid'] = $this->getID();\r
-               } \r
-                       \r
-               //$blogurl = $this->getURL() . $qargs;\r
-               $blogurl = createBlogLink($this->getURL(), $linkparams);\r
-\r
-               $template =& $manager->getTemplate($template);\r
-\r
-               echo TEMPLATE::fill($template['CATLIST_HEADER'],\r
-                                                       array(\r
-                                                               'blogid' => $this->getID(),\r
-                                                               'blogurl' => $blogurl,\r
-                                                               'self' => $CONF['Self']\r
-                                                       ));\r
-\r
-               $query = 'SELECT catid, cdesc as catdesc, cname as catname FROM '.sql_table('category').' WHERE cblog=' . $this->getID() . ' ORDER BY cname ASC';\r
-               $res = sql_query($query);\r
-\r
-\r
-               while ($data = mysql_fetch_assoc($res)) {\r
-                       $data['blogid'] = $this->getID();       \r
-                       $data['blogurl'] = $blogurl;\r
-                       $data['catlink'] = createCategoryLink($data['catid'], $linkparams);\r
-                       $data['self'] = $CONF['Self'];\r
-\r
-                       $temp = TEMPLATE::fill($template['CATLIST_LISTITEM'],$data);\r
-                       echo strftime($temp,$current->itime);\r
-\r
-               }\r
-               \r
-               mysql_free_result($res);\r
-\r
-               echo TEMPLATE::fill($template['CATLIST_FOOTER'],\r
-                                                       array(\r
-                                                               'blogid' => $this->getID(),\r
-                                                               'blogurl' => $blogurl,\r
-                                                               'self' => $CONF['Self']                                                         \r
-                                                       ));\r
-       }\r
-\r
-       /**\r
-         * Blogsettings functions\r
-         */\r
-         \r
-       function readSettings() {\r
-               $query =  'SELECT *'\r
-                      . ' FROM '.sql_table('blog')\r
-                      . ' WHERE bnumber=' . $this->blogid;\r
-               $res = sql_query($query);\r
-               \r
-               $this->isValid = (mysql_num_rows($res) > 0);\r
-               if (!$this->isValid)\r
-                       return;\r
-               \r
-               $this->settings = mysql_fetch_assoc($res);\r
-       }\r
-       \r
-       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
-                       $offset = intval($offset);\r
-               \r
-               $query =  'UPDATE '.sql_table('blog')\r
-                      . " SET bname='" . addslashes($this->getName()) . "',"\r
-                      . "     bshortname='". addslashes($this->getShortName()) . "',"\r
-                      . "     bcomments=". intval($this->commentsEnabled()) . ","\r
-                      . "     bmaxcomments=" . intval($this->getMaxComments()) . ","\r
-                      . "     btimeoffset=" . $offset . ","\r
-                      . "     bpublic=" . intval($this->isPublic()) . ","\r
-                      . "     bsendping=" . intval($this->pingUserland()) . ","\r
-                      . "     bconvertbreaks=" . intval($this->convertBreaks()) . ","\r
-                      . "     ballowpast=" . intval($this->allowPastPosting()) . ","                      \r
-                      . "     bnotify='" . addslashes($this->getNotifyAddress()) . "',"\r
-                      . "     bnotifytype=" . intval($this->getNotifyType()) . ","                    \r
-                      . "     burl='" . addslashes($this->getURL()) . "',"\r
-                      . "     bupdate='" . addslashes($this->getUpdateFile()) . "',"\r
-                      . "     bdesc='" . addslashes($this->getDescription()) . "',"\r
-                      . "     bdefcat=" . intval($this->getDefaultCategory()) . ","                   \r
-                      . "     bdefskin=" . intval($this->getDefaultSkin()) . ","\r
-                      . "     bincludesearch=" . intval($this->getSearchable())\r
-                      . " WHERE bnumber=" . intval($this->getID());\r
-               sql_query($query);\r
-\r
-       }\r
-       \r
-\r
-               \r
-       // update update file if requested\r
-       function updateUpdatefile() {\r
-                if ($this->getUpdateFile()) {\r
-                       $f_update = fopen($this->getUpdateFile(),'w');\r
-                       fputs($f_update,$this->getCorrectTime());\r
-                       fclose($f_update);\r
-                }\r
-\r
-       }\r
-       \r
-       /**\r
-         * Sends a XML-RPC ping message to Userland, so the weblog can\r
-         * show up in the weblogs.com updates-list\r
-         */\r
-       function sendUserlandPing() {\r
-               global $php_errormsg;\r
-               \r
-                if ($this->pingUserland()) {\r
-                         // testmessage for adding an item\r
-                         $message = new xmlrpcmsg('weblogUpdates.ping',array(\r
-                                       new xmlrpcval($this->getName(),'string'),       \r
-                                       new xmlrpcval($this->getURL(),'string')\r
-                         ));\r
-                         \r
-                         $c = new xmlrpc_client('/RPC2', 'rpc.weblogs.com', 80);\r
-\r
-                         // $c->setDebug(1);\r
-\r
-                         $r = $c->send($message,15); // 15 seconds timeout...\r
-                         \r
-                         if (($r == 0) && ($r->errno || $r->errstring)) {\r
-                               return 'Error ' . $r->errno . ' : ' . $r->errstring;\r
-                         } elseif (($r == 0) && ($php_errormsg)) {\r
-                               return 'PHP Error: ' . $php_errormsg;\r
-                         } elseif ($r == 0) {\r
-                               return 'Error while trying to send ping. Sorry about that.';\r
-                         } elseif ($r->faultCode() != 0) {\r
-                               return 'Error: ' . $r->faultString();\r
-                         } else {\r
-                                 $r = $r->value();     // get response struct\r
-                                 // get values\r
-                                 $flerror = $r->structmem('flerror');\r
-                                 $flerror = $flerror->scalarval();\r
\r
-                                 \r
-                                 $message = $r->structmem('message');\r
-                                 $message = $message->scalarval();\r
-\r
-                                 if ($flerror != 0)\r
-                                       return 'Error (flerror=1): ' . $message;\r
-                                 else\r
-                                       return 'Success: ' . $message;\r
-                         }                       \r
-                }\r
-       }\r
-       \r
-       function isValidCategory($catid) {\r
-               $query = 'SELECT * FROM '.sql_table('category').' WHERE cblog=' . $this->getID() . ' and catid=' . intval($catid);\r
-               return (mysql_num_rows(mysql_query($query)) != 0);\r
-       }\r
-       \r
-       function getCategoryName($catid) {\r
-               $res = mysql_query('SELECT cname FROM '.sql_table('category').' WHERE cblog='.$this->getID().' and catid=' . intval($catid));\r
-               $o = mysql_fetch_object($res);\r
-               return $o->cname;\r
-       }\r
-       \r
-       function getCategoryDesc($catid) {\r
-               $res = mysql_query('SELECT cdesc FROM '.sql_table('category').' WHERE cblog='.$this->getID().' and catid=' . intval($catid));\r
-               $o = mysql_fetch_object($res);\r
-               return $o->cdesc;\r
-       }\r
-\r
-       function getCategoryIdFromName($name) {\r
-               $res = mysql_query('SELECT catid FROM '.sql_table('category').' WHERE cblog='.$this->getID().' and cname="' . addslashes($name) . '"');\r
-               if (mysql_num_rows($res) > 0) {\r
-                       $o = mysql_fetch_object($res);\r
-                       return $o->catid;       \r
-               } else {\r
-                       return $this->getDefaultCategory();\r
-               }\r
-       }\r
-       \r
-       function pingUserland() {\r
-               return $this->getSetting('bsendping');\r
-       }\r
-       \r
-       function setPingUserland($val) {\r
-               $this->setSetting('bsendping',$val);\r
-       }\r
-       \r
-       function convertBreaks() {\r
-               return $this->getSetting('bconvertbreaks');\r
-       }\r
-       \r
-       function insertJavaScriptInfo($authorid = '') {\r
-               global $member, $CONF;\r
-               \r
-               if ($authorid == '')    \r
-                       $authorid = $member->getID();\r
-                       \r
-               ?>\r
-               <script type="text/javascript">\r
-                       setConvertBreaks(<?php echo  $this->convertBreaks() ? 'true' : 'false' ?>);\r
-                       setMediaUrl("<?php echo $CONF['MediaURL']?>");\r
-                       setAuthorId(<?php echo $authorid?>);\r
-               </script><?php  }\r
-       \r
-       function setConvertBreaks($val) {\r
-               $this->setSetting('bconvertbreaks',$val);\r
-       }\r
-       function setAllowPastPosting($val) {\r
-               $this->setSetting('ballowpast',$val);\r
-       }               \r
-       function allowPastPosting() {\r
-               return $this->getSetting('ballowpast');\r
-       }\r
-       \r
-       function getCorrectTime($t=0) {\r
-               if ($t == 0) $t = time();\r
-               return ($t + 3600 * $this->getTimeOffset());\r
-       }\r
-       \r
-       function getName() {\r
-               return $this->getSetting('bname');\r
-       }\r
-       \r
-       function getShortName() {\r
-               return $this->getSetting('bshortname');\r
-       }\r
-       \r
-       function getMaxComments() {\r
-               return $this->getSetting('bmaxcomments');\r
-       }\r
-       \r
-       function getNotifyAddress() {\r
-               return $this->getSetting('bnotify');\r
-       }\r
-       \r
-       function getNotifyType() {\r
-               return $this->getSetting('bnotifytype');\r
-       }\r
-       \r
-       function notifyOnComment() {\r
-               $n = $this->getNotifyType();\r
-               return (($n != 0) && (($n % 3) == 0));\r
-       }\r
-\r
-       function notifyOnVote() {\r
-               $n = $this->getNotifyType();\r
-               return (($n != 0) && (($n % 5) == 0));\r
-       }\r
-\r
-       function notifyOnNewItem() {\r
-               $n = $this->getNotifyType();\r
-               return (($n != 0) && (($n % 7) == 0));\r
-       }\r
-       \r
-       function setNotifyType($val) {\r
-               $this->setSetting('bnotifytype',$val);  \r
-       }\r
-       \r
-\r
-       function getTimeOffset() {\r
-               return $this->getSetting('btimeoffset');\r
-       }\r
-       \r
-       function commentsEnabled() {\r
-               return $this->getSetting('bcomments');\r
-       }\r
-       \r
-       function getURL() {\r
-               return $this->getSetting('burl');\r
-       }\r
-       \r
-       function getDefaultSkin() {\r
-               return $this->getSetting('bdefskin');\r
-       }\r
-       \r
-       function getUpdateFile() {\r
-               return $this->getSetting('bupdate');\r
-       }\r
-       \r
-       function getDescription() {\r
-               return $this->getSetting('bdesc');\r
-       }\r
-       \r
-       function isPublic() {\r
-               return $this->getSetting('bpublic');\r
-       }\r
-       \r
-       function getSearchable() {\r
-               return $this->getSetting('bincludesearch');\r
-       }\r
-\r
-       function getDefaultCategory() {\r
-               return $this->getSetting('bdefcat');\r
-       }\r
-       \r
-       function setPublic($val) {\r
-               $this->setSetting('bpublic',$val);\r
-       }\r
-\r
-       function setSearchable($val) {\r
-               $this->setSetting('bincludesearch',$val);\r
-       }\r
-\r
-       function setDescription($val) {\r
-               $this->setSetting('bdesc',$val);\r
-       }\r
-\r
-       function setUpdateFile($val) {\r
-               $this->setSetting('bupdate',$val);\r
-       }\r
-       \r
-       function setDefaultSkin($val) {\r
-               $this->setSetting('bdefskin',$val);\r
-       }\r
-       \r
-       function setURL($val) {\r
-               $this->setSetting('burl',$val);\r
-       }\r
-       \r
-       function setName($val) {\r
-               $this->setSetting('bname',$val);\r
-       }\r
-       \r
-       function setShortName($val) {\r
-               $this->setSetting('bshortname',$val);\r
-       }\r
-       \r
-       function setCommentsEnabled($val) { \r
-               $this->setSetting('bcomments',$val);\r
-       }\r
-       \r
-       function setMaxComments($val) {\r
-               $this->setSetting('bmaxcomments',$val);\r
-       }\r
-       \r
-       function setNotifyAddress($val) {\r
-               $this->setSetting('bnotify',$val);\r
-       }\r
-       \r
-       function setTimeOffset($val) {\r
-               // check validity of value\r
-               // 1. replace , by . (common mistake)\r
-               $val = str_replace(',','.',$val);\r
-               // 2. cast to float or int\r
-               if (is_numeric($val) && strstr($val,'.5')) {\r
-                       $val = (float) $val;\r
-               } else {\r
-                       $val = intval($val);\r
-               }\r
-       \r
-               $this->setSetting('btimeoffset',$val);\r
-       }\r
-       \r
-       function setDefaultCategory($val) {\r
-               $this->setSetting('bdefcat',$val);\r
-       }\r
-\r
-       function getSetting($key) {\r
-               return $this->settings[$key];\r
-       }\r
-       \r
-       function setSetting($key,$value) {\r
-               $this->settings[$key] = $value;\r
-       }\r
-       \r
-       \r
-       // tries to add a member to the team. Returns false if the member was already on\r
-       // the team\r
-       function addTeamMember($memberid, $admin) {\r
-               global $manager;\r
-               \r
-               $memberid = intval($memberid);\r
-               $admin = intval($admin);\r
-               \r
-               // check if member is already a member\r
-               $tmem = MEMBER::createFromID($memberid);\r
-               \r
-               if ($tmem->isTeamMember($this->getID()))\r
-                       return 0;\r
-               \r
-               $manager->notify(\r
-                       'PreAddTeamMember',\r
-                       array(\r
-                               'blog' => &$this,\r
-                               'member' => &$tmem,\r
-                               'admin' => &$admin\r
-                       )\r
-               );\r
-               \r
-               // add to team\r
-               $query = 'INSERT INTO '.sql_table('team').' (TMEMBER, TBLOG, TADMIN) '\r
-                      . 'VALUES (' . $memberid .', '.$this->getID().', "'.$admin.'")';\r
-               sql_query($query);\r
-               \r
-               $manager->notify(\r
-                       'PostAddTeamMember',\r
-                       array(\r
-                               'blog' => &$this,\r
-                               'member' => &$tmem,\r
-                               'admin' => $admin\r
-                       )\r
-                       \r
-               );\r
-               \r
-               ACTIONLOG::add(INFO, 'Added ' . $tmem->getDisplayName() . ' (ID=' .\r
-                              $memberid .') to the team of blog "' . $this->getName() . '"');\r
-               \r
-               return 1;\r
-       }\r
-       \r
-       function getID() {\r
-               return $this->blogid;\r
-       }\r
-       \r
-       // returns true if there is a blog with the given shortname (static)\r
-       function exists($name) {\r
-               $r = sql_query('select * FROM '.sql_table('blog').' WHERE bshortname="'.addslashes($name).'"');\r
-               return (mysql_num_rows($r) != 0);\r
-       }\r
-\r
-       // returns true if there is a blog with the given ID (static)\r
-       function existsID($id) {\r
-               $r = sql_query('select * FROM '.sql_table('blog').' WHERE bnumber='.intval($id));\r
-               return (mysql_num_rows($r) != 0);\r
-       }       \r
-       \r
-       \r
-}\r
-\r
-/**\r
-  * This class is used when parsing item templates\r
-  */\r
-class ITEMACTIONS extends BaseActions {\r
-\r
-       // contains an assoc array with parameters that need to be included when\r
-       // generating links to items/archives/... (e.g. catid)\r
-       var $linkparams;\r
-       \r
-       // true when the current user is a blog admin (and thus allowed to edit all items)\r
-       var $allowEditAll;\r
-       \r
-       // timestamp of last visit\r
-       var $lastVisit;\r
-       \r
-       // item currently being handled (mysql result object, see BLOG::showUsingQuery)\r
-       var $currentItem;\r
-       \r
-       // reference to the blog currently being displayed\r
-       var $blog;\r
-       \r
-       // associative array with template info (part name => contents)\r
-       var $template;\r
-       \r
-       // true when comments need to be displayed\r
-       var $showComments;\r
-       \r
-       function ITEMACTIONS(&$blog) {\r
-               // call constructor of superclass first\r
-               $this->BaseActions();   \r
-               \r
-               // extra parameters for created links\r
-               global $catid;\r
-               if ($catid)\r
-                       $this->linkparams = array('catid' => $catid);\r
-                       \r
-               // check if member is blog admin (and thus allowed to edit all items)\r
-               global $member;\r
-               $this->allowEditAll = ($member->isLoggedIn() && $member->blogAdminRights($blog->getID()));\r
-               $this->setBlog($blog);\r
-       }\r
-\r
-       function getDefinedActions() {\r
-               return array(\r
-                       'blogid',\r
-                       'title',\r
-                       'body',\r
-                       'more',\r
-                       'smartbody',\r
-                       'itemid',\r
-                       'morelink',\r
-                       'category',\r
-                       'categorylink',\r
-                       'author',\r
-                       'authorid',\r
-                       'authorlink',\r
-                       'catid',\r
-                       'karma',\r
-                       'date',\r
-                       'time',\r
-                       'query',\r
-                       'itemlink',\r
-                       'blogurl',\r
-                       'closed',\r
-                       'syndicate_title',\r
-                       'syndicate_description',\r
-                       'karmaposlink',\r
-                       'karmaneglink',\r
-                       'new',\r
-                       'image',\r
-                       'popup',\r
-                       'media',\r
-                       'daylink',\r
-                       'query',\r
-                       'include',\r
-                       'phpinclude',\r
-                       'parsedinclude',\r
-                       'skinfile',\r
-                       'set',\r
-                       'plugin',\r
-                       'edit',\r
-                       'editlink',\r
-                       'editpopupcode',\r
-                       'comments',\r
-                       'relevance'\r
-               );\r
-       }\r
-       \r
-\r
-       \r
-       function setLastVisit($lastVisit) {             $this->lastVisit = $lastVisit; }\r
-       function setParser(&$parser) {                  $this->parser =& $parser; }\r
-       function setCurrentItem(&$item) {               $this->currentItem =& $item; }\r
-       function setBlog(&$blog) {                              $this->blog =& $blog; }\r
-       function setTemplate($template) {               $this->template =& $template; }\r
-       function setShowComments($val) {                $this->showComments = $val; }\r
-       \r
-       // methods used by parser to insert content\r
-       \r
-       function parse_blogid() {               echo $this->blog->getID();      }\r
-       function parse_body() {                 $this->highlightAndParse($this->currentItem->body); }\r
-       function parse_title() {                $this->highlightAndParse($this->currentItem->title); }\r
-       function parse_more() {                 $this->highlightAndParse($this->currentItem->more); }   \r
-       function parse_itemid() {               echo $this->currentItem->itemid; }              \r
-       function parse_category() {             echo $this->currentItem->category; }                            \r
-       function parse_categorylink() { echo createCategoryLink($this->currentItem->catid); }                           \r
-       function parse_catid() {                echo $this->currentItem->catid; }                                       \r
-       function parse_authorid() {             echo $this->currentItem->authorid; }\r
-       function parse_authorlink() {   echo createMemberLink($this->currentItem->authorid, $this->linkparams); }       \r
-       function parse_query() {                echo $this->strHighlight; }\r
-       function parse_itemlink() {             echo createItemLink($this->currentItem->itemid, $this->linkparams); }\r
-       function parse_blogurl() {              echo $this->blog->getURL(); }\r
-       function parse_closed() {               echo $this->currentItem->closed; }\r
-       function parse_relevance() {    echo round($this->currentItem->score,2);}\r
-       \r
-       function parse_karma($type = 'totalscore') {\r
-               global $manager;\r
-\r
-               // get karma object\r
-               $karma =& $manager->getKarma($this->currentItem->itemid);\r
-               \r
-               switch($type) {\r
-                       case 'pos':\r
-                               echo $karma->getNbPosVotes();\r
-                               break;\r
-                       case 'neg':\r
-                               echo $karma->getNbNegVotes();\r
-                               break;                          \r
-                       case 'votes':\r
-                               echo $karma->getNbOfVotes();\r
-                               break;          \r
-                       case 'posp':\r
-                               $percentage = $karma->getNbOfVotes() ? 100 * ($karma->getNbPosVotes() / $karma->getNbOfVotes()) : 50;\r
-                               echo number_format($percentage,2), '%';                         \r
-                               break;                          \r
-                       case 'negp':\r
-                               $percentage = $karma->getNbOfVotes() ? 100 * ($karma->getNbNegVotes() / $karma->getNbOfVotes()) : 50;\r
-                               echo number_format($percentage,2), '%';                         \r
-                               break;                          \r
-                       case 'totalscore':\r
-                       default:\r
-                               echo $karma->getTotalScore();\r
-                               break;\r
-               }\r
-               \r
-       }                                               \r
-\r
-       function parse_author($which = '') {            \r
-               switch($which)\r
-               {\r
-                       case 'realname':\r
-                               echo $this->currentItem->authorname;\r
-                               break;\r
-                       case 'id':\r
-                               echo $this->currentItem->authorid;\r
-                               break;\r
-                       case 'email':\r
-                               echo $this->currentItem->authormail;\r
-                               break;\r
-                       case 'url':\r
-                               echo $this->currentItem->authorurl;\r
-                               break;\r
-                       case 'name':\r
-                       default:\r
-                               echo $this->currentItem->author;\r
-               }\r
-       }               \r
-       \r
-       function parse_smartbody() {\r
-               if (!$this->currentItem->more) {\r
-                       $this->highlightAndParse($this->currentItem->body);\r
-               } else {\r
-                       $this->highlightAndParse($this->currentItem->more);             \r
-               }\r
-       }\r
-\r
-       function parse_morelink() {             \r
-               if ($this->currentItem->more)\r
-                       $this->parser->parse($this->template['MORELINK']);\r
-       }                       \r
-       \r
-       function parse_date($format = '') {\r
-               echo formatDate($format, $this->currentItem->timestamp, $this->template['FORMAT_DATE']);\r
-       }\r
-       \r
-       /**\r
-         * @param format optional strftime format\r
-         */\r
-       function parse_time($format = '') {                     \r
-               echo strftime($format ? $format : $this->template['FORMAT_TIME'],$this->currentItem->timestamp); \r
-       }\r
-       \r
-       /**\r
-         * @param maxLength optional maximum length\r
-         */\r
-       function parse_syndicate_title($maxLength = 100) { \r
-               $syndicated = strip_tags($this->currentItem->title);\r
-               echo htmlspecialchars(shorten($syndicated,$maxLength,'...'));\r
-       }\r
-       \r
-       /**\r
-         * @param maxLength optional maximum length\r
-         */\r
-       function parse_syndicate_description($maxLength = 250, $addHighlight = 0) { \r
-               $syndicated = strip_tags($this->currentItem->body);\r
-               if ($addHighlight) {\r
-                   echo $this->highlightAndParse(htmlspecialchars(shorten($syndicated,$maxLength,'...')));\r
-               } else {\r
-               echo htmlspecialchars(shorten($syndicated,$maxLength,'...'));\r
-               }\r
-       }\r
-       \r
-       function parse_karmaposlink($text = '') { \r
-               global $CONF;\r
-               $link = $CONF['ActionURL'] . '?action=votepositive&amp;itemid='.$this->currentItem->itemid; \r
-               echo $text ? '<a href="'.$link.'">'.$text.'</a>' : $link;\r
-       }\r
-       \r
-       function parse_karmaneglink($text = '') { \r
-               global $CONF;\r
-               $link = $CONF['ActionURL'] . '?action=votenegative&amp;itemid='.$this->currentItem->itemid; \r
-               echo $text ? '<a href="'.$link.'">'.$text.'</a>' : $link;\r
-       }\r
-       \r
-       function parse_new() {  \r
-               if (($this->lastVisit != 0) && ($this->currentItem->timestamp > $this->lastVisit))\r
-                       echo $this->template['NEW'];\r
-       }\r
-       \r
-       function parse_image() {\r
-               // image/popup calls have arguments separated by |\r
-               $args = func_get_args();\r
-               $args = explode('|',implode($args,', '));\r
-               call_user_func_array(array(&$this,'createImageCode'),$args);\r
-       }\r
-       function parse_popup() {\r
-               // image/popup calls have arguments separated by |\r
-               $args = func_get_args();\r
-               $args = explode('|',implode($args,', '));\r
-               call_user_func_array(array(&$this,'createPopupCode'),$args);\r
-       }\r
-       function parse_media() {\r
-               // image/popup calls have arguments separated by |\r
-               $args = func_get_args();\r
-               $args = explode('|',implode($args,', '));\r
-               call_user_func_array(array(&$this,'createMediaCode'),$args);\r
-       }\r
-       \r
-       function parse_daylink() {              \r
-               echo createArchiveLink($this->blog->getID(), strftime('%Y-%m-%d',$this->currentItem->timestamp), $this->linkparams);\r
-       }\r
-       \r
-       function parse_comments($maxToShow = 0) {\r
-               if ($maxToShow == 0)\r
-                       $maxToShow = $this->blog->getMaxComments();\r
-                       \r
-               // add comments\r
-               if ($this->showComments && $this->blog->commentsEnabled()) {\r
-                       $comments =& new COMMENTS($this->currentItem->itemid);\r
-                       $comments->setItemActions($this);\r
-                       $comments->showComments($this->template, $maxToShow, $this->currentItem->closed ? 0 : 1, $this->strHighlight); \r
-               }\r
-       }\r
-\r
-       /**\r
-         * Executes a plugin templatevar\r
-         *\r
-         * @param pluginName name of plugin (without the NP_)\r
-         * \r
-         * extra parameters can be added\r
-         */\r
-       function parse_plugin($pluginName) {\r
-               global $manager;\r
-               \r
-               // only continue when the plugin is really installed\r
-               if (!$manager->pluginInstalled('NP_' . $pluginName))\r
-                       return;\r
-               \r
-               $plugin =& $manager->getPlugin('NP_' . $pluginName);\r
-               if (!$plugin) return;\r
-\r
-               // get arguments\r
-               $params = func_get_args();\r
-               \r
-               // remove plugin name \r
-               array_shift($params);\r
-               \r
-               // add item reference (array_unshift didn't work)\r
-               $params = array_merge(array(&$this->currentItem),$params);\r
-\r
-               call_user_func_array(array(&$plugin,'doTemplateVar'), $params);\r
-       }\r
-       \r
-       function parse_edit() {\r
-               global $member, $CONF;\r
-               if ($this->allowEditAll || ($member->isLoggedIn() && ($member->getID() == $this->currentItem->authorid)) ) {\r
-                       $this->parser->parse($this->template['EDITLINK']);\r
-               }\r
-       }\r
-       \r
-       function parse_editlink() {\r
-               global $CONF;\r
-               echo $CONF['AdminURL'],'bookmarklet.php?action=edit&amp;itemid=',$this->currentItem->itemid;\r
-       }\r
-       \r
-       function parse_editpopupcode() {\r
-               echo "if (event &amp;&amp; event.preventDefault) event.preventDefault();winbm=window.open(this.href,'nucleusbm','scrollbars=yes,width=600,height=500,left=10,top=10,status=yes,resizable=yes');winbm.focus();return false;";\r
-       }\r
-       \r
-       // helper functions\r
-\r
-       /**\r
-         * Parses highlighted text, with limited actions only (to prevent not fully trusted team members\r
-         * from hacking your weblog. \r
-         */\r
-       function highlightAndParse(&$data) {\r
-               // allow only a limited subset of actions (do not allow includes etc, they might be evil)\r
-               $this->parser->actions = array('image','media','popup');\r
-               $this->parser->parse($this->highlight($data));\r
-               $this->parser->actions = $this->getDefinedActions();\r
-       }\r
-       \r
-       function createPopupCode($filename, $width, $height, $text = '') {\r
-               global $CONF;\r
-       \r
-               // select private collection when no collection given\r
-               if (!strstr($filename,'/')) {\r
-                       $filename = $this->currentItem->authorid . '/' . $filename;\r
-               }\r
-               \r
-               $windowwidth = $width;\r
-               $windowheight = $height;\r
-               \r
-               $vars['rawpopuplink']   = $CONF['Self'] . "?imagepopup=" . htmlspecialchars($filename) . "&amp;width=$width&amp;height=$height&amp;imagetext=" . urlencode(htmlspecialchars($text));\r
-               $vars['popupcode']              = "window.open(this.href,'imagepopup','status=no,toolbar=no,scrollbars=no,resizable=yes,width=$windowwidth,height=$windowheight');return false;";\r
-               $vars['popuptext']              = htmlspecialchars($text);\r
-               $vars['popuplink']              = '<a href="' . $vars['rawpopuplink']. '" onclick="'. $vars['popupcode'].'" >' . $vars['popuptext'] . '</a>';\r
-               $vars['width']                  = $width;\r
-               $vars['height']                 = $height;\r
-               $vars['text']                   = $text;\r
-               \r
-               echo TEMPLATE::fill($this->template['POPUP_CODE'],$vars);\r
-       }\r
-       \r
-       function createImageCode($filename, $width, $height, $text = '') {\r
-               global $CONF;\r
-               \r
-               // select private collection when no collection given\r
-               if (!strstr($filename,'/')) {\r
-                       $filename = $this->currentItem->authorid . '/' . $filename;\r
-               }\r
-               \r
-               $windowwidth = $width;\r
-               $windowheight = $height;\r
-               \r
-               $vars['link']                   = htmlspecialchars($CONF['MediaURL']. $filename);\r
-               $vars['text']                   = htmlspecialchars($text);\r
-               $vars['image'] = '<img src="' . $vars['link'] . '" width="' . $width . '" height="' . $height . '" alt="' . $vars['text'] . '" title="' . $vars['text'] . '" />';\r
-               $vars['width']                  = $width;\r
-               $vars['height']                 = $height;\r
-                               \r
-               \r
-               \r
-               echo TEMPLATE::fill($this->template['IMAGE_CODE'],$vars);;\r
-\r
-       }\r
-       \r
-       function createMediaCode($filename, $text = '') {\r
-               global $CONF;\r
-               \r
-               // select private collection when no collection given\r
-               if (!strstr($filename,'/')) {\r
-                       $filename = $this->currentItem->authorid . '/' . $filename;\r
-               }               \r
-\r
-               $vars['link']                   = htmlspecialchars($CONF['MediaURL'] . $filename);\r
-               $vars['text']                   = htmlspecialchars($text);\r
-               $vars['media']                  = '<a href="' . $vars['link'] . '">' . $vars['text'] . '</a>';\r
-\r
-               echo TEMPLATE::fill($this->template['MEDIA_CODE'],$vars);;\r
-       }\r
-       \r
-       \r
-}\r
-\r
-\r
-// used for mail notification (html -> text)\r
-\r
-function toAscii($html) {\r
-       // strip off most tags \r
-       $html = strip_tags($html,'<a>');\r
-       $to_replace = "/<a[^>]*href=[\"\']([^\"^']*)[\"\'][^>]*>([^<]*)<\/a>/i"; \r
-       _links_init(); \r
-       $ascii = preg_replace_callback ($to_replace, '_links_add', $html); \r
-       $ascii .= "\n\n" . _links_list(); \r
-       return strip_tags($ascii);\r
-}\r
-\r
-function _links_init() { \r
-   global $tmp_links; \r
-   $tmp_links = array(); \r
-} \r
-\r
-function _links_add($match) { \r
-   global $tmp_links; \r
-   array_push($tmp_links, $match[1]); \r
-   return $match[2] . ' [' . sizeof($tmp_links) .']'; \r
-} \r
-\r
-function _links_list() { \r
-   global $tmp_links; \r
-   $output = ''; \r
-   $i = 1; \r
-   foreach ($tmp_links as $current) { \r
-      $output .= "[$i] $current\n"; \r
-      $i++; \r
-   } \r
-   return $output; \r
-} \r
-\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 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-2007 The Nucleus Group
+ * @version $Id: BLOG.php,v 1.4 2007-03-22 09:23:58 kimitake Exp $
+ * $NucleusJP: BLOG.php,v 1.11 2007/03/20 19:31:29 kmorimatsu Exp $
+ */
+
+if ( !function_exists('requestVar') ) exit;
+require_once dirname(__FILE__) . '/ITEMACTIONS.php';
+
+class BLOG {
+
+       // blog id
+       var $blogid;
+
+       // ID of currently selected category
+       var $selectedcatid;
+
+       // After creating an object of the blog class, contains true if the BLOG object is
+       // valid (the blog exists)
+       var $isValid;
+
+       // associative array, containing all blogsettings (use the get/set functions instead)
+       var $settings;
+
+       /**
+        * Creates a new BLOG object for the given blog
+        *
+        * @param $id blogid
+        */
+       function BLOG($id) {
+               $this->blogid = intval($id);
+               $this->readSettings();
+
+               // try to set catid
+               // (the parse functions in SKIN.php will override this, so it's mainly useless)
+               global $catid;
+               $this->setSelectedCategory($catid);
+       }
+
+       /**
+        * Shows the given amount of items for this blog
+        *
+        * @param $template
+        *              String representing the template _NAME_ (!)
+        * @param $amountEntries
+        *              amount of entries to show
+        * @param $startpos
+        *              offset from where items should be shown (e.g. 5 = start at fifth item)
+        * @returns int
+        *              amount of items shown
+        */
+       function readLog($template, $amountEntries, $offset = 0, $startpos = 0) {
+               return $this->readLogAmount($template,$amountEntries,'','',1,1,$offset, $startpos);
+       }
+
+       /**
+        * Shows an archive for a given month
+        *
+        * @param $year
+        *              year
+        * @param $month
+        *              month
+        * @param $template
+        *              String representing the template name to be used
+        */
+       function showArchive($templatename, $year, $month, $day=0) {
+
+               // create extra where clause for select query
+               if ($day == 0) {
+                       $timestamp_start = mktime(0,0,0,$month,1,$year);
+                       $timestamp_end = mktime(0,0,0,$month+1,1,$year);  // also works when $month==12
+               } 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>=' . mysqldate($timestamp_start)
+                                        . ' and i.itime<' . mysqldate($timestamp_end);
+
+
+               $this->readLogAmount($templatename,0,$extra_query,'',1,1);
+
+       }
+
+
+       // sets/gets current category (only when category exists)
+       function setSelectedCategory($catid) {
+               if ($this->isValidCategory($catid) || (intval($catid) == 0))
+                       $this->selectedcatid = intval($catid);
+       }
+
+       function setSelectedCategoryByName($catname) {
+               $this->setSelectedCategory($this->getCategoryIdFromName($catname));
+       }
+
+       function getSelectedCategory() {
+               return $this->selectedcatid;
+       }
+
+       /**
+        * Shows the given amount of items for this blog
+        *
+        * @param $template
+        *              String representing the template _NAME_ (!)
+        * @param $amountEntries
+        *              amount of entries to show (0 = no limit)
+        * @param $extraQuery
+        *              extra conditions to be added to the query
+        * @param $highlight
+        *              contains a query that should be highlighted
+        * @param $comments
+        *              1=show comments 0=don't show comments
+        * @param $dateheads
+        *              1=show dateheads 0=don't show dateheads
+        * @param $offset
+        *              offset
+        * @returns int
+        *              amount of items shown
+        */
+       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);
+       }
+
+       function showUsingQuery($templateName, $query, $highlight = '', $comments = 0, $dateheads = 1) {
+               global $CONF, $manager;
+
+               $lastVisit = cookieVar($CONF['CookiePrefix'] .'lastVisit');
+               if ($lastVisit != 0)
+                       $lastVisit = $this->getCorrectTime($lastVisit);
+
+               // set templatename as global variable (so plugins can access it)
+               global $currentTemplateName;
+               $currentTemplateName = $templateName;
+
+               $template =& $manager->getTemplate($templateName);
+
+               // create parser object & action handler
+               $actions =& new ITEMACTIONS($this);
+               $parser =& new PARSER($actions->getDefinedActions(),$actions);
+               $actions->setTemplate($template);
+               $actions->setHighlight($highlight);
+               $actions->setLastVisit($lastVisit);
+               $actions->setParser($parser);
+               $actions->setShowComments($comments);
+
+               // execute query
+               $items = sql_query($query);
+
+               // loop over all items
+               while ($item = mysql_fetch_object($items)) {
+
+                       $item->timestamp = strtotime($item->itime);     // string timestamp -> unix timestamp
+
+                       // action handler needs to know the item we're handling
+                       $actions->setCurrentItem($item);
+
+                       // add date header if needed
+                       $old_date = 0;
+                       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);
+                                               $manager->notify('PreDateFoot',array('blog' => &$this, 'timestamp' => $oldTS));
+                                               $tmp_footer = strftime($template['DATE_FOOTER'], $oldTS);
+                                               $parser->parse($tmp_footer);
+                                               $manager->notify('PostDateFoot',array('blog' => &$this, 'timestamp' => $oldTS));
+                                       }
+                                       $manager->notify('PreDateHead',array('blog' => &$this, 'timestamp' => $timestamp));
+                                       // note, to use templatvars in the dateheader, the %-characters need to be doubled in
+                                       // order to be preserved by strftime
+                                       $tmp_header = strftime((isset($template['DATE_HEADER']) ? $template['DATE_HEADER'] : null), $timestamp);
+                                       $parser->parse($tmp_header);
+                                       $manager->notify('PostDateHead',array('blog' => &$this, 'timestamp' => $timestamp));
+                               }
+                               $old_date = $new_date;
+                       }
+
+                       // parse item
+                       $parser->parse($template['ITEM_HEADER']);
+                       $manager->notify('PreItem', array('blog' => &$this, 'item' => &$item));
+                       $parser->parse($template['ITEM']);
+                       $manager->notify('PostItem', array('blog' => &$this, 'item' => &$item));
+                       $parser->parse($template['ITEM_FOOTER']);
+
+               }
+
+               $numrows = mysql_num_rows($items);
+
+               // add another date footer if there was at least one item
+               if (($numrows > 0) && $dateheads) {
+                       $manager->notify('PreDateFoot',array('blog' => &$this, 'timestamp' => strtotime($old_date)));
+                       $parser->parse($template['DATE_FOOTER']);
+                       $manager->notify('PostDateFoot',array('blog' => &$this, 'timestamp' => strtotime($old_date)));
+               }
+
+               mysql_free_result($items);      // free memory
+
+               return $numrows;
+
+       }
+
+       function showOneitem($itemid, $template, $highlight) {
+               $extraQuery = ' and inumber=' . intval($itemid);
+
+               return $this->readLogAmount($template, 1, $extraQuery, $highlight, 0, 0);
+       }
+
+
+       /**
+         * Adds an item to this blog
+         */
+       function additem($catid, $title, $body, $more, $blogid, $authorid, $timestamp, $closed, $draft) {
+               global $manager;
+
+               $blogid         = intval($blogid);
+               $authorid       = intval($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();
+
+               if ($timestamp > $this->getCorrectTime())
+                       $isFuture = 1;
+
+               $timestamp = date('Y-m-d H:i:s',$timestamp);
+
+               $manager->notify('PreAddItem',array('title' => &$title, 'body' => &$body, 'more' => &$more, 'blog' => &$this, 'authorid' => &$authorid, 'timestamp' => &$timestamp, 'closed' => &$closed, 'draft' => &$draft, 'catid' => &$catid));
+
+               $title = addslashes($title);
+               $body = addslashes($body);
+               $more = addslashes($more);
+
+               $query = 'INSERT INTO '.sql_table('item').' (ITITLE, IBODY, IMORE, IBLOG, IAUTHOR, ITIME, ICLOSED, IDRAFT, ICAT) '
+                          . "VALUES ('$title', '$body', '$more', $blogid, $authorid, '$timestamp', $closed, $draft, $catid)";
+               sql_query($query);
+               $itemid = mysql_insert_id();
+
+               $manager->notify('PostAddItem',array('itemid' => $itemid));
+
+               if (!$draft)
+                       $this->updateUpdateFile();
+
+               // send notification mail
+               if (!$draft && !$isFuture && $this->getNotifyAddress() && $this->notifyOnNewItem())
+                       $this->sendNewItemNotification($itemid, stripslashes($title), stripslashes($body));
+
+               return $itemid;
+       }
+
+       function sendNewItemNotification($itemid, $title, $body) {
+               global $CONF, $member;
+
+               // create text version of html post
+               $ascii = toAscii($body);
+
+               $mailto_msg = _NOTIFY_NI_MSG . " \n";
+//             $mailto_msg .= $CONF['IndexURL'] . 'index.php?itemid=' . $itemid . "\n\n";
+               $temp = parse_url($CONF['Self']);
+               if ($temp['scheme']) {
+                       $mailto_msg .= createItemLink($itemid) . "\n\n";
+               } else {
+                       $tempurl = $this->getURL();
+                       if (substr($tempurl, -1) == '/' || substr($tempurl, -4) == '.php') {
+                               $mailto_msg .= $tempurl . '?itemid=' . $itemid . "\n\n";
+                       } else {
+                               $mailto_msg .= $tempurl . '/?itemid=' . $itemid . "\n\n";
+                       }
+               }
+               $mailto_msg .= _NOTIFY_TITLE . ' ' . strip_tags($title) . "\n";
+               $mailto_msg .= _NOTIFY_CONTENTS . "\n " . $ascii . "\n";
+               $mailto_msg .= getMailFooter();
+
+               $mailto_title = $this->getName() . ': ' . _NOTIFY_NI_TITLE;
+
+               $frommail = $member->getNotifyFromMailAddress();
+
+               $notify =& new NOTIFICATION($this->getNotifyAddress());
+               $notify->notify($mailto_title, $mailto_msg , $frommail);
+
+
+
+       }
+
+
+       /**
+         * Creates a new category for this blog
+         *
+         * @param $catName
+         *             name of the new category. When empty, a name is generated automatically
+         *             (starting with newcat)
+         * @param $catDescription
+         *             description of the new category. Defaults to 'New Category'
+         *
+         * @returns
+         *             the new category-id in case of success.
+         *             0 on failure
+         */
+       function createNewCategory($catName = '', $catDescription = 'New category') {
+               global $member, $manager;
+
+               if ($member->blogAdminRights($this->getID())) {
+                       // generate
+                       if ($catName == '')
+                       {
+                               $catName = 'newcat';
+                               $i = 1;
+
+                               $res = sql_query('SELECT * FROM '.sql_table('category')." WHERE cname='".$catName.$i."' and cblog=".$this->getID());
+                               while (mysql_num_rows($res) > 0)
+                               {
+                                       $i++;
+                                       $res = sql_query('SELECT * FROM '.sql_table('category')." WHERE cname='".$catName.$i."' and cblog=".$this->getID());
+                               }
+
+                               $catName = $catName . $i;
+                       }
+
+                       $manager->notify(
+                               'PreAddCategory',
+                               array(
+                                       'blog' => &$this,
+                                       'name' => &$catName,
+                                       'description' => $catDescription
+                               )
+                       );
+
+                       $query = 'INSERT INTO '.sql_table('category').' (cblog, cname, cdesc) VALUES (' . $this->getID() . ", '" . addslashes($catName) . "', '" . addslashes($catDescription) . "')";
+                       sql_query($query);
+                       $catid = mysql_insert_id();
+
+                       $manager->notify(
+                               'PostAddCategory',
+                               array(
+                                       'blog' => &$this,
+                                       'name' => $catName,
+                                       'description' => $catDescription,
+                                       'catid' => $catid
+                               )
+                       );
+
+                       return $catid;
+               } else {
+                       return 0;
+               }
+
+       }
+
+
+       /**
+        * Searches all months of this blog for the given query
+        *
+        * @param $query
+        *              search query
+        * @param $template
+        *              template to be used (__NAME__ of the template)
+        * @param $amountMonths
+        *              max amount of months to be search (0 = all)
+        * @param $maxresults
+        *              max number of results to show
+        * @param $startpos
+        *              offset
+        * @returns
+        *              amount of hits found
+        */
+       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'         => htmlspecialchars($query),
+                                       'blogid'        => $this->getID()
+                               );
+                               echo TEMPLATE::fill($template['SEARCH_NOTHINGFOUND'],$vars);
+                       }
+               }
+
+               return $amountfound;
+       }
+
+       /**
+        * Returns an SQL query to use for a search query
+        *
+        * @param $query
+        *              search query
+        * @param $amountMonths
+        *              amount of months to search back. Default = 0 = unlimited
+        * @param $mode
+        *              either empty, or 'count'. In this case, the query will be a SELECT COUNT(*) query
+        * @returns $highlight
+        *              words to highlight (out parameter)
+        * @returns
+        *              either a full SQL query, or an empty string (if querystring empty)
+        * @note
+        *              No LIMIT clause is added. (caller should add this if multiple pages are requested)
+        */
+       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->getID();                       // 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, 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';
+                       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'
+                          . ' and i.idraft=0'  // exclude drafts
+                          . $selectblogs
+                                       // don't show future items
+                          . ' and i.itime<=' . mysqldate($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>' . mysqldate($timestamp_start);
+               }
+
+               if ($mode == '')
+               {
+                       if ($select)
+                               $query .= ' ORDER BY score DESC';
+                       else
+                               $query .= ' ORDER BY i.itime DESC ';
+               }
+
+               return $query;
+       }
+
+       /**
+        * Returns the SQL query that's normally used to display the blog items on the index type skins
+        *
+        * @param $mode
+        *              either empty, or 'count'. In this case, the query will be a SELECT COUNT(*) query
+        * @returns
+        *              either a full SQL query, or an empty string
+        * @note
+        *              No LIMIT clause is added. (caller should add this if multiple pages are requested)
+        */
+       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
+                                       // don't show future items
+                          . ' and i.itime<=' . mysqldate($this->getCorrectTime());
+
+               if ($this->getSelectedCategory())
+                       $query .= ' and i.icat=' . $this->getSelectedCategory() . ' ';
+
+
+               $query .= $extraQuery;
+
+               if ($mode == '')
+                       $query .= ' ORDER BY i.itime DESC';
+
+               return $query;
+       }
+
+       /**
+         * Shows the archivelist using the given template
+         */
+       function showArchiveList($template, $mode = 'month', $limit = 0) {
+               global $CONF, $catid, $manager;
+
+               if ($catid)
+                       $linkparams = array('catid' => $catid);
+
+               $template =& $manager->getTemplate($template);
+               $data['blogid'] = $this->getID();
+
+               echo TEMPLATE::fill($template['ARCHIVELIST_HEADER'],$data);
+
+               $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->getID()
+               . ' and itime <=' . mysqldate($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, Month';
+               if ($mode == 'day')
+                       $query .= ', Day';
+
+
+               $query .= ' ORDER BY itime DESC';
+
+               if ($limit > 0)
+                       $query .= ' LIMIT ' . intval($limit);
+
+               $res = sql_query($query);
+
+               while ($current = mysql_fetch_object($res)) {
+                       $current->itime = strtotime($current->itime);   // string time -> unix timestamp
+
+                       if ($mode == 'day') {
+                               $archivedate = date('Y-m-d',$current->itime);
+                               $archive['day'] = date('d',$current->itime);
+                       } else {
+                               $archivedate = date('Y-m',$current->itime);
+                       }
+                       $data['month'] = date('m',$current->itime);
+                       $data['year'] = date('Y',$current->itime);
+                       $data['archivelink'] = createArchiveLink($this->getID(),$archivedate,$linkparams);
+
+                       $temp = TEMPLATE::fill($template['ARCHIVELIST_LISTITEM'],$data);
+                       echo strftime($temp,$current->itime);
+
+               }
+
+               mysql_free_result($res);
+
+               echo TEMPLATE::fill($template['ARCHIVELIST_FOOTER'],$data);
+       }
+
+
+       /**
+         * Shows the list of categories using a given template
+         */
+       function showCategoryList($template) {
+               global $CONF, $manager;
+
+               // determine arguments next to catids
+               // I guess this can be done in a better way, but it works
+               global $archive, $archivelist;
+
+               $linkparams = array();
+               if ($archive) {
+                       $blogurl = createArchiveLink($this->getID(), $archive, '');
+                       $linkparams['blogid'] = $this->getID();
+                       $linkparams['archive'] = $archive;
+               } else if ($archivelist) {
+                       $blogurl = createArchiveListLink($this->getID(), '');
+                       $linkparams['archivelist'] = $archivelist;
+               } else {
+                       $blogurl = createBlogidLink($this->getID(), '');
+                       $linkparams['blogid'] = $this->getID();
+               }
+
+               //$blogurl = $this->getURL() . $qargs;
+               //$blogurl = createBlogLink($this->getURL(), $linkparams);
+
+               $template =& $manager->getTemplate($template);
+
+               echo TEMPLATE::fill((isset($template['CATLIST_HEADER']) ? $template['CATLIST_HEADER'] : null),
+                                                       array(
+                                                               'blogid' => $this->getID(),
+                                                               'blogurl' => $blogurl,
+                                                               'self' => $CONF['Self']
+                                                       ));
+
+               $query = 'SELECT catid, cdesc as catdesc, cname as catname FROM '.sql_table('category').' WHERE cblog=' . $this->getID() . ' ORDER BY cname ASC';
+               $res = sql_query($query);
+
+
+               while ($data = mysql_fetch_assoc($res)) {
+                       $data['blogid'] = $this->getID();
+                       $data['blogurl'] = $blogurl;
+                       $data['catlink'] = createLink(
+                                                               'category',
+                                                               array(
+                                                                       'catid' => $data['catid'],
+                                                                       'name' => $data['catname'],
+                                                                       'extra' => $linkparams
+                                                               )
+                                                          );
+                       $data['self'] = $CONF['Self'];
+
+                       echo TEMPLATE::fill((isset($template['CATLIST_LISTITEM']) ? $template['CATLIST_LISTITEM'] : null), $data);
+                       //$temp = TEMPLATE::fill((isset($template['CATLIST_LISTITEM']) ? $template['CATLIST_LISTITEM'] : null), $data);
+                       //echo strftime($temp, $current->itime);
+
+               }
+
+               mysql_free_result($res);
+
+               echo TEMPLATE::fill((isset($template['CATLIST_FOOTER']) ? $template['CATLIST_FOOTER'] : null),
+                                                       array(
+                                                               'blogid' => $this->getID(),
+                                                               'blogurl' => $blogurl,
+                                                               'self' => $CONF['Self']
+                                                       ));
+       }
+       
+       /**
+         * Shows a list of all blogs in the system using a given template
+         */
+       function showBlogList($template, $bnametype) {
+               global $CONF, $manager;
+               
+               $template =& $manager->getTemplate($template);
+               
+               echo TEMPLATE::fill((isset($template['BLOGLIST_HEADER']) ? $template['BLOGLIST_HEADER'] : null),
+                                                       array(
+                                                               'sitename' => $CONF['SiteName'],
+                                                               'siteurl' => $CONF['IndexURL']
+                                                       ));
+               
+               $query = 'SELECT bnumber, bname, bshortname, bdesc, burl FROM '.sql_table('blog').' ORDER BY bnumber ASC';
+               $res = sql_query($query);
+               
+               while ($data = mysql_fetch_assoc($res)) {
+               
+                       $list = array();
+               
+                       $list['bloglink'] = createLink('blog', array('blogid' => $data['bnumber']));
+               
+                       $list['blogdesc'] = $data['bdesc'];
+                       
+                       if ($bnametype=='shortname') {
+                               $list['blogname'] = $data['bshortname'];
+                       }
+                       else { // all other cases
+                               $list['blogname'] = $data['bname'];
+                       }
+                       
+                       echo TEMPLATE::fill((isset($template['BLOGLIST_LISTITEM']) ? $template['BLOGLIST_LISTITEM'] : null), $list);
+                       
+               }
+               
+               mysql_free_result($res);
+               
+               echo TEMPLATE::fill((isset($template['BLOGLIST_FOOTER']) ? $template['BLOGLIST_FOOTER'] : null),
+                                                       array(
+                                                               'sitename' => $CONF['SiteName'],
+                                                               'siteurl' => $CONF['IndexURL']
+                                                       ));
+
+       }
+
+       /**
+         * Blogsettings functions
+         */
+
+       function readSettings() {
+               $query =  'SELECT *'
+                          . ' FROM '.sql_table('blog')
+                          . ' WHERE bnumber=' . $this->blogid;
+               $res = sql_query($query);
+
+               $this->isValid = (mysql_num_rows($res) > 0);
+               if (!$this->isValid)
+                       return;
+
+               $this->settings = mysql_fetch_assoc($res);
+       }
+
+       function writeSettings() {
+
+               // (can't use floatval since not available prior to PHP 4.2)
+               $offset = $this->getTimeOffset();
+               if (!is_float($offset))
+                       $offset = intval($offset);
+
+               $query =  'UPDATE '.sql_table('blog')
+                          . " SET bname='" . addslashes($this->getName()) . "',"
+                          . "     bshortname='". addslashes($this->getShortName()) . "',"
+                          . "     bcomments=". intval($this->commentsEnabled()) . ","
+                          . "     bmaxcomments=" . intval($this->getMaxComments()) . ","
+                          . "     btimeoffset=" . $offset . ","
+                          . "     bpublic=" . intval($this->isPublic()) . ","
+                          . "     breqemail=" . intval($this->emailRequired()) . ","
+                          . "     bsendping=" . intval($this->pingUserland()) . ","
+                          . "     bconvertbreaks=" . intval($this->convertBreaks()) . ","
+                          . "     ballowpast=" . intval($this->allowPastPosting()) . ","
+                          . "     bnotify='" . addslashes($this->getNotifyAddress()) . "',"
+                          . "     bnotifytype=" . intval($this->getNotifyType()) . ","
+                          . "     burl='" . addslashes($this->getURL()) . "',"
+                          . "     bupdate='" . addslashes($this->getUpdateFile()) . "',"
+                          . "     bdesc='" . addslashes($this->getDescription()) . "',"
+                          . "     bdefcat=" . intval($this->getDefaultCategory()) . ","
+                          . "     bdefskin=" . intval($this->getDefaultSkin()) . ","
+                          . "     bincludesearch=" . intval($this->getSearchable())
+                          . " WHERE bnumber=" . intval($this->getID());
+               sql_query($query);
+
+       }
+
+
+
+       // update update file if requested
+       function updateUpdatefile() {
+                if ($this->getUpdateFile()) {
+                       $f_update = fopen($this->getUpdateFile(),'w');
+                       fputs($f_update,$this->getCorrectTime());
+                       fclose($f_update);
+                }
+
+       }
+
+       /**
+         * Sends a XML-RPC ping message to Userland, so the weblog can
+         * show up in the weblogs.com updates-list
+         */
+       function sendUserlandPing() {
+               global $php_errormsg;
+
+                if ($this->pingUserland()) {
+                         // testmessage for adding an item
+                         $message = new xmlrpcmsg('weblogUpdates.ping',array(
+                                       new xmlrpcval($this->getName(),'string'),
+                                       new xmlrpcval($this->getURL(),'string')
+                         ));
+
+                         $c = new xmlrpc_client('/RPC2', 'rpc.weblogs.com', 80);
+
+                         // $c->setDebug(1);
+
+                         $r = $c->send($message,15); // 15 seconds timeout...
+
+                         if (($r == 0) && ($r->errno || $r->errstring)) {
+                               return 'Error ' . $r->errno . ' : ' . $r->errstring;
+                         } elseif (($r == 0) && ($php_errormsg)) {
+                               return 'PHP Error: ' . $php_errormsg;
+                         } elseif ($r == 0) {
+                               return 'Error while trying to send ping. Sorry about that.';
+                         } elseif ($r->faultCode() != 0) {
+                               return 'Error: ' . $r->faultString();
+                         } else {
+                                 $r = $r->value();     // get response struct
+                                 // get values
+                                 $flerror = $r->structmem('flerror');
+                                 $flerror = $flerror->scalarval();
+
+
+                                 $message = $r->structmem('message');
+                                 $message = $message->scalarval();
+
+                                 if ($flerror != 0)
+                                       return 'Error (flerror=1): ' . $message;
+                                 else
+                                       return 'Success: ' . $message;
+                         }
+                }
+       }
+
+       function isValidCategory($catid) {
+               $query = 'SELECT * FROM '.sql_table('category').' WHERE cblog=' . $this->getID() . ' and catid=' . intval($catid);
+               $res = mysql_query($query);
+               return (mysql_num_rows($res) != 0);
+       }
+
+       function getCategoryName($catid) {
+               $res = mysql_query('SELECT cname FROM '.sql_table('category').' WHERE cblog='.$this->getID().' and catid=' . intval($catid));
+               $o = mysql_fetch_object($res);
+               return $o->cname;
+       }
+
+       function getCategoryDesc($catid) {
+               $res = mysql_query('SELECT cdesc FROM '.sql_table('category').' WHERE cblog='.$this->getID().' and catid=' . intval($catid));
+               $o = mysql_fetch_object($res);
+               return $o->cdesc;
+       }
+
+       function getCategoryIdFromName($name) {
+               $res = mysql_query('SELECT catid FROM '.sql_table('category').' WHERE cblog='.$this->getID().' and cname="' . addslashes($name) . '"');
+               if (mysql_num_rows($res) > 0) {
+                       $o = mysql_fetch_object($res);
+                       return $o->catid;
+               } else {
+                       return $this->getDefaultCategory();
+               }
+       }
+
+       function pingUserland() {
+               return $this->getSetting('bsendping');
+       }
+
+       function setPingUserland($val) {
+               $this->setSetting('bsendping',$val);
+       }
+
+       function convertBreaks() {
+               return $this->getSetting('bconvertbreaks');
+       }
+
+       function insertJavaScriptInfo($authorid = '') {
+               global $member, $CONF;
+
+               if ($authorid == '')
+                       $authorid = $member->getID();
+
+               ?>
+               <script type="text/javascript">
+                       setConvertBreaks(<?php echo  $this->convertBreaks() ? 'true' : 'false' ?>);
+                       setMediaUrl("<?php echo $CONF['MediaURL']?>");
+                       setAuthorId(<?php echo $authorid?>);
+               </script><?php  }
+
+       function setConvertBreaks($val) {
+               $this->setSetting('bconvertbreaks',$val);
+       }
+       function setAllowPastPosting($val) {
+               $this->setSetting('ballowpast',$val);
+       }
+       function allowPastPosting() {
+               return $this->getSetting('ballowpast');
+       }
+
+       function getCorrectTime($t=0) {
+               if ($t == 0) $t = time();
+               return ($t + 3600 * $this->getTimeOffset());
+       }
+
+       function getName() {
+               return $this->getSetting('bname');
+       }
+
+       function getShortName() {
+               return $this->getSetting('bshortname');
+       }
+
+       function getMaxComments() {
+               return $this->getSetting('bmaxcomments');
+       }
+
+       function getNotifyAddress() {
+               return $this->getSetting('bnotify');
+       }
+
+       function getNotifyType() {
+               return $this->getSetting('bnotifytype');
+       }
+
+       function notifyOnComment() {
+               $n = $this->getNotifyType();
+               return (($n != 0) && (($n % 3) == 0));
+       }
+
+       function notifyOnVote() {
+               $n = $this->getNotifyType();
+               return (($n != 0) && (($n % 5) == 0));
+       }
+
+       function notifyOnNewItem() {
+               $n = $this->getNotifyType();
+               return (($n != 0) && (($n % 7) == 0));
+       }
+
+       function setNotifyType($val) {
+               $this->setSetting('bnotifytype',$val);
+       }
+
+
+       function getTimeOffset() {
+               return $this->getSetting('btimeoffset');
+       }
+
+       function commentsEnabled() {
+               return $this->getSetting('bcomments');
+       }
+
+       function getURL() {
+               return $this->getSetting('burl');
+       }
+
+       function getDefaultSkin() {
+               return $this->getSetting('bdefskin');
+       }
+
+       function getUpdateFile() {
+               return $this->getSetting('bupdate');
+       }
+
+       function getDescription() {
+               return $this->getSetting('bdesc');
+       }
+
+       function isPublic() {
+               return $this->getSetting('bpublic');
+       }
+
+       function emailRequired() {
+               return $this->getSetting('breqemail');
+       }
+
+       function getSearchable() {
+               return $this->getSetting('bincludesearch');
+       }
+
+       function getDefaultCategory() {
+               return $this->getSetting('bdefcat');
+       }
+
+       function setPublic($val) {
+               $this->setSetting('bpublic',$val);
+       }
+
+       function setSearchable($val) {
+               $this->setSetting('bincludesearch',$val);
+       }
+
+       function setDescription($val) {
+               $this->setSetting('bdesc',$val);
+       }
+
+       function setUpdateFile($val) {
+               $this->setSetting('bupdate',$val);
+       }
+
+       function setDefaultSkin($val) {
+               $this->setSetting('bdefskin',$val);
+       }
+
+       function setURL($val) {
+               $this->setSetting('burl',$val);
+       }
+
+       function setName($val) {
+               $this->setSetting('bname',$val);
+       }
+
+       function setShortName($val) {
+               $this->setSetting('bshortname',$val);
+       }
+
+       function setCommentsEnabled($val) {
+               $this->setSetting('bcomments',$val);
+       }
+
+       function setMaxComments($val) {
+               $this->setSetting('bmaxcomments',$val);
+       }
+
+       function setNotifyAddress($val) {
+               $this->setSetting('bnotify',$val);
+       }
+
+       function setEmailRequired($val) {
+               $this->setSetting('breqemail',$val);
+       }
+
+       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) && strstr($val,'.5')) {
+                       $val = (float) $val;
+               } else {
+                       $val = intval($val);
+               }
+
+               $this->setSetting('btimeoffset',$val);
+       }
+
+       function setDefaultCategory($val) {
+               $this->setSetting('bdefcat',$val);
+       }
+
+       function getSetting($key) {
+               return $this->settings[$key];
+       }
+
+       function setSetting($key,$value) {
+               $this->settings[$key] = $value;
+       }
+
+
+       // tries to add a member to the team. Returns false if the member was already on
+       // the team
+       function addTeamMember($memberid, $admin) {
+               global $manager;
+
+               $memberid = intval($memberid);
+               $admin = intval($admin);
+
+               // check if member is already a member
+               $tmem = MEMBER::createFromID($memberid);
+
+               if ($tmem->isTeamMember($this->getID()))
+                       return 0;
+
+               $manager->notify(
+                       'PreAddTeamMember',
+                       array(
+                               'blog' => &$this,
+                               'member' => &$tmem,
+                               'admin' => &$admin
+                       )
+               );
+
+               // add to team
+               $query = 'INSERT INTO '.sql_table('team').' (TMEMBER, TBLOG, TADMIN) '
+                          . 'VALUES (' . $memberid .', '.$this->getID().', "'.$admin.'")';
+               sql_query($query);
+
+               $manager->notify(
+                       'PostAddTeamMember',
+                       array(
+                               'blog' => &$this,
+                               'member' => &$tmem,
+                               'admin' => $admin
+                       )
+
+               );
+
+               ACTIONLOG::add(INFO, 'Added ' . $tmem->getDisplayName() . ' (ID=' .
+                                          $memberid .') to the team of blog "' . $this->getName() . '"');
+
+               return 1;
+       }
+
+       function getID() {
+               return intVal($this->blogid);
+       }
+
+       // returns true if there is a blog with the given shortname (static)
+       function exists($name) {
+               $r = sql_query('select * FROM '.sql_table('blog').' WHERE bshortname="'.addslashes($name).'"');
+               return (mysql_num_rows($r) != 0);
+       }
+
+       // returns true if there is a blog with the given ID (static)
+       function existsID($id) {
+               $r = sql_query('select * FROM '.sql_table('blog').' WHERE bnumber='.intval($id));
+               return (mysql_num_rows($r) != 0);
+       }
+
+
+}
+
+?>
\ No newline at end of file
index 673dd1d..4142c3f 100755 (executable)
-<?php\r
-\r
-/**\r
-  * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
-  * Copyright (C) 2002-2005 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
-  * A class representing a single comment\r
-  *\r
-  * $Id: COMMENT.php,v 1.3 2005-03-16 08:10:35 kimitake Exp $\r
-  * $NucleusJP: COMMENT.php,v 1.3 2005/03/12 06:19:05 kimitake Exp $\r
-  */\r
-class COMMENT {\r
-\r
-       /**\r
-         * Returns the requested comment (static)\r
-         */\r
-       function getComment($commentid) {\r
-               $query =  'SELECT cnumber as commentid, cbody as body, cuser as user, cmail as userid, cmember as memberid, ctime, chost as host, mname as member, cip as ip, cblog as blogid'\r
-                          . ' FROM '.sql_table('comment').' left outer join '.sql_table('member').' on cmember=mnumber'\r
-                          . ' WHERE cnumber=' . intval($commentid);\r
-               $comments = sql_query($query);\r
-\r
-               $aCommentInfo = mysql_fetch_assoc($comments);\r
-               if ($aCommentInfo)\r
-               {\r
-                       $aCommentInfo['timestamp'] = strtotime($aCommentInfo['ctime']);\r
-               }\r
-               return $aCommentInfo;\r
-       }\r
-\r
-       /**\r
-         * prepares a comment to be saved\r
-         * (static)\r
-         */\r
-       function prepare($comment) {\r
-               $comment['user'] = strip_tags($comment['user']);\r
-               $comment['userid'] = strip_tags($comment['userid']);\r
-\r
-               // remove quotes and newlines from user and userid\r
-               $comment['user'] = strtr($comment['user'], "\'\"\n",'-- ');\r
-               $comment['userid'] = strtr($comment['userid'], "\'\"\n",'-- ');\r
-\r
-               $comment['body'] = COMMENT::prepareBody($comment['body']);\r
-\r
-               return $comment;\r
-       }\r
-\r
-       // prepares the body of a comment (static)\r
-       function prepareBody($body) {\r
-\r
-               // remove newlines when too many in a row\r
-               $body = ereg_replace("\n.\n.\n","\n",$body);\r
-\r
-               // encode special characters as entities\r
-               $body = htmlspecialchars($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
-               $replaceFrom = array(\r
-                       '/([^:\/\/\w]|^)((https:\/\/)([a-z0-9_\.-]+)([\/a-z0-9_+\.~%&?@=_:;#,-]+))/ie',\r
-                       '/([^:\/\/\w]|^)((http:\/\/|www\.)([a-z0-9_\.-]+)([\/a-z0-9_+\.~%&?@=_:;#,-]+))/ie',\r
-                       '/([^:\/\/\w]|^)((ftp:\/\/|ftp\.)([a-z0-9_\.-]+)([\/a-z0-9_+\.~%&?@=_:;#,-]+))/ie',\r
-                       '/([^:\/\/\w]|^)(mailto:(([a-zA-Z\@\%\.\-\+_])+))/ie'\r
-               );\r
-               $replaceTo = array(\r
-                       'COMMENT::createLinkCode("\\1", "\\2","https")',\r
-                       'COMMENT::createLinkCode("\\1", "\\2","http")',\r
-                       'COMMENT::createLinkCode("\\1", "\\2","ftp")',\r
-                       'COMMENT::createLinkCode("\\1", "\\3","mailto")'\r
-               );\r
-               $body = preg_replace($replaceFrom, $replaceTo, $body);\r
-\r
-               return $body;\r
-       }\r
-\r
-       function createLinkCode($pre, $url, $protocol = 'http') {\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 = strpos($url, $entity);\r
-                       if ($pos)\r
-                       {\r
-                               $post = substr($url, $pos) . $post;\r
-                               $url = substr($url, 0, $pos);\r
-\r
-                       }\r
-               }\r
-\r
-               // remove entities at end (&&&&)\r
-               if (preg_match('/(&\w+;)+$/i', $url, $matches)) {\r
-                       $post = $matches[0] . $post;    // found entities (1 or more)\r
-                       $url = substr($url, 0, strlen($url) - strlen($post));\r
-               }\r
-\r
-               // move ending comma from url to 'post' part\r
-               if (substr($url, strlen($url) - 1) == ',')\r
-               {\r
-                       $url = substr($url, 0, strlen($url) - 1);\r
-                       $post = ',' . $post;\r
-               }\r
-\r
-               if (!ereg('^'.$protocol.'://',$url))\r
-                       $linkedUrl = $protocol . (($protocol == 'mailto') ? ':' : '://') . $url;\r
-               else\r
-                       $linkedUrl = $url;\r
-\r
-\r
-               if ($protocol != 'mailto')\r
-                       $displayedUrl = $linkedUrl;\r
-               else\r
-                       $displayedUrl = $url;\r
-               return $pre . '<a href="'.$linkedUrl.'" rel="nofollow">'.shorten($displayedUrl,30,'...').'</a>' . $post;\r
-       }\r
-\r
-}\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,v 1.4 2007-03-22 09:23:58 kimitake Exp $
+ * $NucleusJP: COMMENT.php,v 1.5 2007/02/04 06:28:46 kimitake Exp $
+ */
+class COMMENT {
+
+       /**
+         * Returns the requested comment (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 '.sql_table('comment').' left outer join '.sql_table('member').' on cmember=mnumber'
+                          . ' WHERE cnumber=' . intval($commentid);
+               $comments = sql_query($query);
+
+               $aCommentInfo = mysql_fetch_assoc($comments);
+               if ($aCommentInfo)
+               {
+                       $aCommentInfo['timestamp'] = strtotime($aCommentInfo['ctime']);
+               }
+               return $aCommentInfo;
+       }
+
+       /**
+         * prepares a comment to be saved
+         * (static)
+         */
+       function prepare($comment) {
+               $comment['user'] = strip_tags($comment['user']);
+               $comment['userid'] = strip_tags($comment['userid']);
+               $comment['email'] = strip_tags($comment['email']);
+
+               // remove quotes and newlines from user and userid
+               $comment['user'] = strtr($comment['user'], "\'\"\n",'-- ');
+               $comment['userid'] = strtr($comment['userid'], "\'\"\n",'-- ');
+               $comment['email'] = strtr($comment['email'], "\'\"\n",'-- ');
+
+               $comment['body'] = COMMENT::prepareBody($comment['body']);
+
+               return $comment;
+       }
+
+       // prepares the body of a comment (static)
+       function prepareBody($body) {
+
+               // remove newlines when too many in a row
+               $body = ereg_replace("\n.\n.\n","\n",$body);
+
+               // encode special characters as entities
+               $body = htmlspecialchars($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
+               $replaceFrom = array(
+                       '/([^:\/\/\w]|^)((https:\/\/)([\w\.-]+)([\/\w+\.~%&?@=_:;#,-]+))/ie',
+                       '/([^:\/\/\w]|^)((http:\/\/|www\.)([\w\.-]+)([\/\w+\.~%&?@=_:;#,-]+))/ie',
+                       '/([^:\/\/\w]|^)((ftp:\/\/|ftp\.)([\w\.-]+)([\/\w+\.~%&?@=_:;#,-]+))/ie',
+                       '/([^:\/\/\w]|^)(mailto:(([a-zA-Z\@\%\.\-\+_])+))/ie'
+               );
+               $replaceTo = array(
+                       'COMMENT::createLinkCode("\\1", "\\2","https")',
+                       'COMMENT::createLinkCode("\\1", "\\2","http")',
+                       'COMMENT::createLinkCode("\\1", "\\2","ftp")',
+                       'COMMENT::createLinkCode("\\1", "\\3","mailto")'
+               );
+               $body = preg_replace($replaceFrom, $replaceTo, $body);
+
+               return $body;
+       }
+
+       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 = strpos($url, $entity);
+                       if ($pos)
+                       {
+                               $post = substr($url, $pos) . $post;
+                               $url = 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 = substr($url, 0, strlen($url) - strlen($post));
+               }
+
+               // move ending comma from url to 'post' part
+               if (substr($url, strlen($url) - 1) == ',')
+               {
+                       $url = substr($url, 0, strlen($url) - 1);
+                       $post = ',' . $post;
+               }
+
+               if (!ereg('^'.$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">'.shorten($displayedUrl,30,'...').'</a>' . $post;
+       }
+
+}
+
+?>
\ No newline at end of file
index 01ccdf7..85eb66f 100755 (executable)
-<?php\r
-\r
-\r
-/**\r
-  * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
-  * Copyright (C) 2002-2005 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
-  * Class representing a skin\r
-  *\r
-  * $Id: SKIN.php,v 1.5 2005-03-16 08:10:35 kimitake Exp $\r
-  * $NucleusJP: SKIN.php,v 1.4 2005/03/12 06:19:05 kimitake Exp $\r
-  */\r
-class SKIN {\r
-\r
-       // after creating a SKIN object, evaluates to true when the skin exists\r
-       var $isValid;\r
-       \r
-       // skin characteristics. Use the getXXX methods rather than accessing directly\r
-       var $id;\r
-       var $description;\r
-       var $contentType;\r
-       var $includeMode;               // either 'normal' or 'skindir'\r
-       var $includePrefix;\r
-       var $name;\r
-       \r
-       function SKIN($id) {\r
-               $this->id = intval($id);\r
-\r
-               // read skin name/description/content type\r
-               $res = sql_query('SELECT * FROM '.sql_table('skin_desc').' WHERE sdnumber=' . $this->id);\r
-               $obj = mysql_fetch_object($res);\r
-               $this->isValid = (mysql_num_rows($res) > 0);\r
-               if (!$this->isValid)\r
-                       return;\r
-                       \r
-               $this->name = $obj->sdname;\r
-               $this->description = $obj->sddesc;\r
-               $this->contentType = $obj->sdtype;\r
-               $this->includeMode = $obj->sdincmode;\r
-               $this->includePrefix = $obj->sdincpref;\r
-\r
-       }\r
-       \r
-       function getID() {                              return $this->id; }\r
-       function getName() {                    return $this->name; }\r
-       function getDescription() {     return $this->description; }\r
-       function getContentType() {     return $this->contentType; }\r
-       function getIncludeMode() {     return $this->includeMode; }\r
-       function getIncludePrefix() {   return $this->includePrefix; }\r
-       \r
-       // returns true if there is a skin with the given shortname (static)\r
-       function exists($name) {\r
-               return quickQuery('select count(*) as result FROM '.sql_table('skin_desc').' WHERE sdname="'.addslashes($name).'"') > 0;\r
-       }\r
-\r
-       // returns true if there is a skin with the given ID (static)\r
-       function existsID($id) {\r
-               return quickQuery('select COUNT(*) as result FROM '.sql_table('skin_desc').' WHERE sdnumber='.intval($id)) > 0;\r
-       }       \r
-       \r
-       // (static)\r
-       function createFromName($name) {\r
-               return new SKIN(SKIN::getIdFromName($name));\r
-       }       \r
-       \r
-       // (static)\r
-       function getIdFromName($name) {\r
-               $query =  'SELECT sdnumber'\r
-                      . ' FROM '.sql_table('skin_desc')\r
-                      . ' WHERE sdname="'.addslashes($name).'"';\r
-               $res = sql_query($query);\r
-               $obj = mysql_fetch_object($res);\r
-               return $obj->sdnumber;  \r
-       }\r
-       \r
-       // (static)\r
-       function getNameFromId($id) {\r
-               return quickQuery('SELECT sdname as result FROM '.sql_table('skin_desc').' WHERE sdnumber=' . intval($id));\r
-       }\r
-       \r
-       /**\r
-        * Creates a new skin, with the given characteristics.\r
-        *\r
-        * (static)\r
-        */\r
-       function createNew($name, $desc, $type = 'text/html', $includeMode = 'normal', $includePrefix = '') {\r
-               global $manager;\r
-               \r
-               $manager->notify(\r
-                       'PreAddSkin',\r
-                       array(\r
-                               'name' => &$name,\r
-                               'description' => &$desc,\r
-                               'type' => &$type,\r
-                               'includeMode' => &$includeMode,\r
-                               'includePrefix' => &$includePrefix\r
-                       )\r
-               );\r
-\r
-               sql_query('INSERT INTO '.sql_table('skin_desc')." (sdname, sddesc, sdtype, sdincmode, sdincpref) VALUES ('" . addslashes($name) . "','" . addslashes($desc) . "','".addslashes($type)."','".addslashes($includeMode)."','".addslashes($includePrefix)."')");\r
-               $newid = mysql_insert_id();\r
-               \r
-               $manager->notify(\r
-                       'PostAddSkin',\r
-                       array(\r
-                               'skinid' => $newid,\r
-                               'name' => $name,\r
-                               'description' => $desc,\r
-                               'type' => $type,\r
-                               'includeMode' => $includeMode,\r
-                               'includePrefix' => $includePrefix\r
-                       )\r
-               );\r
-               \r
-               return $newid;\r
-       }\r
-       \r
-       function parse($type) {\r
-               global $manager, $CONF;\r
-\r
-               // set output type\r
-               sendContentType($this->getContentType(), 'skin', _CHARSET);\r
-\r
-               // set skin name as global var (so plugins can access it)\r
-               global $currentSkinName;\r
-               $currentSkinName = $this->getName();\r
-\r
-               $contents = $this->getContent($type);\r
-\r
-               if (!$contents) {\r
-                       // use base skin if this skin does not have contents\r
-                       $defskin =& new SKIN($CONF['BaseSkin']);\r
-                       $contents = $defskin->getContent($type);\r
-                       if (!$contents) {\r
-                               echo _ERROR_SKIN;\r
-                               return;\r
-                       }\r
-               }\r
-\r
-               $actions = $this->getAllowedActionsForType($type);\r
-\r
-               $manager->notify('PreSkinParse',array('skin' => &$this, 'type' => $type));\r
-\r
-               // set IncludeMode properties of parser\r
-               PARSER::setProperty('IncludeMode',$this->getIncludeMode());\r
-               PARSER::setProperty('IncludePrefix',$this->getIncludePrefix());\r
-\r
-               $handler =& new ACTIONS($type, $this);\r
-               $parser =& new PARSER($actions, $handler);\r
-               $handler->setParser($parser);\r
-               $handler->setSkin($this);\r
-               $parser->parse($contents);\r
-\r
-               $manager->notify('PostSkinParse',array('skin' => &$this, 'type' => $type));\r
-\r
-\r
-       }\r
-\r
-       function getContent($type) {\r
-               $query = 'SELECT scontent FROM '.sql_table('skin')." WHERE sdesc=$this->id and stype='". addslashes($type) ."'";\r
-               $res = sql_query($query);\r
-\r
-               if (mysql_num_rows($res) == 0)\r
-                       return '';\r
-               else\r
-                       return mysql_result($res, 0, 0);\r
-       }\r
-\r
-       /**\r
-        * Updates the contents of one part of the skin\r
-        */\r
-       function update($type, $content) {\r
-               $skinid = $this->id;\r
-\r
-               // delete old thingie\r
-               sql_query('DELETE FROM '.sql_table('skin')." WHERE stype='".addslashes($type)."' and sdesc=" . intval($skinid));\r
-\r
-               // write new thingie\r
-               if ($content) {\r
-                       sql_query('INSERT INTO '.sql_table('skin')." SET scontent='" . addslashes($content) . "', stype='" . addslashes($type) . "', sdesc=" . intval($skinid));\r
-               }       \r
-       }\r
-       \r
-       /**\r
-        * Deletes all skin parts from the database\r
-        */\r
-       function deleteAllParts() {\r
-               sql_query('DELETE FROM '.sql_table('skin').' WHERE sdesc='.$this->getID());\r
-       }\r
-       \r
-       /**\r
-        * Updates the general information about the skin\r
-        */\r
-       function updateGeneralInfo($name, $desc, $type = 'text/html', $includeMode = 'normal', $includePrefix = '') {\r
-               $query =  'UPDATE '.sql_table('skin_desc').' SET'\r
-                      . " sdname='" . addslashes($name) . "',"\r
-                      . " sddesc='" . addslashes($desc) . "',"\r
-                      . " sdtype='" . addslashes($type) . "',"\r
-                          . " sdincmode='" . addslashes($includeMode) . "',"\r
-                          . " sdincpref='" . addslashes($includePrefix) . "'"                 \r
-                      . " WHERE sdnumber=" . $this->getID();\r
-               sql_query($query);              \r
-       }\r
-       \r
-       /**\r
-        * static: returns an array of friendly names\r
-        */\r
-       function getFriendlyNames() {\r
-               return array(\r
-                       'index' => _SKIN_PART_MAIN,\r
-                       'item' => _SKIN_PART_ITEM,\r
-                       'archivelist' => _SKIN_PART_ALIST,\r
-                       'archive' => _SKIN_PART_ARCHIVE,\r
-                       'search' => _SKIN_PART_SEARCH,\r
-                       'error' => _SKIN_PART_ERROR,\r
-                       'member' => _SKIN_PART_MEMBER,\r
-                       'imagepopup' => _SKIN_PART_POPUP\r
-               );      \r
-       }\r
-       \r
-       function getAllowedActionsForType($type) {\r
-               // some actions that can be performed at any time, from anywhere\r
-               $defaultActions = array('otherblog',\r
-                                                               'plugin',\r
-                                                               'version',\r
-                                                               'nucleusbutton',\r
-                                                               'include',\r
-                                                               'phpinclude',\r
-                                                               'parsedinclude',\r
-                                                               'loginform',\r
-                                                               'sitevar',\r
-                                                               'otherarchivelist',\r
-                                                               'otherarchivedaylist',\r
-                                                               'self',\r
-                                                               'adminurl',\r
-                                                               'todaylink',\r
-                                                               'archivelink',\r
-                                                               'member',\r
-                                                               'ifcat',                                        // deprecated (Nucleus v2.0)\r
-                                                               'category',\r
-                                                               'searchform',\r
-                                                               'referer',\r
-                                                               'skinname',\r
-                                                               'skinfile',\r
-                                                               'set',\r
-                                                               'if',\r
-                                                               'else',\r
-                                                               'endif'\r
-                                                               );\r
-               \r
-               // extra actions specific for a certain skin type\r
-               $extraActions = array();\r
-\r
-               switch ($type) {\r
-                       case 'index':\r
-                               $extraActions = array('blog', \r
-                                                   'blogsetting',\r
-                                                   'preview',\r
-                                                   'additemform',\r
-                                                               'categorylist',                                             \r
-                                                   'archivelist',\r
-                                                   'archivedaylist',\r
-                                                   'nextlink',\r
-                                                   'prevlink'\r
-                                                   );                          \r
-                               break;\r
-                       case 'archive':\r
-                               $extraActions = array('blog',\r
-                                                               'archive',\r
-                                                               'otherarchive',\r
-                                                               'categorylist',                                                         \r
-                                                               'archivelist',\r
-                                                   'archivedaylist',                                                           \r
-                                                               'blogsetting',\r
-                                                               'archivedate',\r
-                                                           'nextarchive',\r
-                                                           'prevarchive',\r
-                                                           'nextlink',\r
-                                                           'prevlink',\r
-                                                           'archivetype'\r
-                               );\r
-                               break;\r
-                       case 'archivelist':\r
-                               $extraActions = array('blog',\r
-                                                           'archivelist',\r
-                                                               'archivedaylist',\r
-                                                               'categorylist',\r
-                                                           'blogsetting',\r
-                                                          );\r
-                               break;\r
-                       case 'search':\r
-                               $extraActions = array('blog',\r
-                                                               'archivelist',\r
-                                                   'archivedaylist',\r
-                                                               'categorylist',\r
-                                                               'searchresults',\r
-                                                               'othersearchresults',\r
-                                                               'blogsetting',\r
-                                                               'query',\r
-                                                               'nextlink',\r
-                                                               'prevlink'\r
-                                                               );\r
-                               break;\r
-                       case 'imagepopup':\r
-                               $extraActions = array('image',\r
-                                                               'imagetext',                            // deprecated (Nucleus v2.0)\r
-                                                               );\r
-                               break;\r
-                       case 'member':\r
-                               $extraActions = array(\r
-                                                               'membermailform',\r
-                                                               'blogsetting',\r
-                                                               'nucleusbutton'\r
-                               );\r
-                               break;\r
-                       case 'item':\r
-                               $extraActions = array('blog',\r
-                                                           'item',\r
-                                                           'comments',\r
-                                                           'commentform',\r
-                                                           'vars',\r
-                                                           'blogsetting',\r
-                                                           'nextitem',\r
-                                                           'previtem',\r
-                                                           'nextlink',\r
-                                                           'prevlink',\r
-                                                           'nextitemtitle',\r
-                                                           'previtemtitle',\r
-                                                               'categorylist',                                                     \r
-                                                           'archivelist',\r
-                                                   'archivedaylist',                                                       \r
-                                                           'itemtitle',\r
-                                                           'itemid',\r
-                                                           'itemlink',\r
-                                                           );\r
-                               break;\r
-                       case 'error':\r
-                               $extraActions = array(\r
-                                                               'errormessage'\r
-                               );\r
-                               break;\r
-               }\r
-               return array_merge($defaultActions, $extraActions);\r
-       }\r
-       \r
-}\r
-\r
-\r
-/*\r
- * This class contains the functions that get called by using\r
- * the special tags in the skins\r
- *\r
- * The allowed tags for a type of skinpart are defined by the \r
- * SKIN::getAllowedActionsForType($type) method\r
- */\r
-class ACTIONS extends BaseActions {\r
-\r
-       // part of the skin currently being parsed ('index', 'item', 'archive',\r
-       // 'archivelist', 'member', 'search', 'error', 'imagepopup')\r
-       var $skintype;\r
-       \r
-       // contains an assoc array with parameters that need to be included when\r
-       // generating links to items/archives/... (e.g. catid)  \r
-       var $linkparams;\r
-       \r
-       // reference to the skin object for which a part is being parsed\r
-       var $skin;\r
-       \r
-\r
-       // used when including templated forms from the include/ dir. The $formdata var \r
-       // contains the values to fill out in there (assoc array name -> value)\r
-       var $formdata;\r
-       \r
-\r
-       // filled out with the number of displayed items after calling one of the \r
-\r
-       // (other)blog/(other)searchresults skinvars.\r
-\r
-       var $amountfound;\r
-\r
-       function ACTIONS($type) {\r
-               // call constructor of superclass first\r
-               $this->BaseActions();\r
-\r
-               $this->skintype = $type;\r
-\r
-               global $catid;\r
-               if ($catid) \r
-                       $this->linkparams = array('catid' => $catid);\r
-       }\r
-\r
-       function setSkin(&$skin) {\r
-               $this->skin =& $skin;\r
-       }\r
-       \r
-       function setParser(&$parser) {\r
-               $this->parser =& $parser;\r
-       }\r
-       \r
-       /*\r
-               Forms get parsedincluded now, using an extra <formdata> skinvar\r
-       */\r
-       function doForm($filename) {\r
-               global $DIR_NUCLEUS;\r
-               array_push($this->parser->actions,'formdata','text','callback','errordiv');\r
-               $oldIncludeMode = PARSER::getProperty('IncludeMode');\r
-               $oldIncludePrefix = PARSER::getProperty('IncludePrefix');\r
-               PARSER::setProperty('IncludeMode','normal');\r
-               PARSER::setProperty('IncludePrefix','');\r
-               $this->parse_parsedinclude($DIR_NUCLEUS . 'forms/' . $filename . '.template');\r
-               PARSER::setProperty('IncludeMode',$oldIncludeMode);\r
-               PARSER::setProperty('IncludePrefix',$oldIncludePrefix);\r
-               array_pop($this->parser->actions);              // errordiv\r
-               array_pop($this->parser->actions);              // callback\r
-               array_pop($this->parser->actions);              // text\r
-               array_pop($this->parser->actions);              // formdata\r
-       }\r
-       function parse_formdata($what) {\r
-               echo $this->formdata[$what];\r
-       }\r
-       function parse_text($which) {\r
-               // constant($which) only available from 4.0.4 :(\r
-               if (defined($which)) {  \r
-                       eval("echo $which;");\r
-               }\r
-       }\r
-       function parse_callback($eventName, $type)\r
-       {\r
-               global $manager;\r
-               $manager->notify($eventName, array('type' => $type));\r
-       }\r
-       function parse_errordiv() {\r
-               global $errormessage;\r
-               if ($errormessage)\r
-                       echo '<div class="error">', htmlspecialchars($errormessage),'</div>';\r
-       }\r
-       \r
-       function parse_skinname() {\r
-               echo $this->skin->getName();\r
-       }\r
-       \r
-       function parse_if($field, $name='', $value = '') {\r
-               global $catid, $blog, $member, $itemidnext, $itemidprev, $manager;\r
-\r
-               $condition = 0;\r
-               switch($field) {\r
-                       case 'category':\r
-                               $condition = ($blog && $this->_ifCategory($name,$value));\r
-                               break;\r
-                       case 'blogsetting':\r
-                               if ($name == 'trackback' && $manager->pluginInstalled('NP_TrackBack')) {\r
-                                       $plugin =& $manager->getPlugin('NP_TrackBack');\r
-                                       if ($plugin != NULL && $blog){\r
-                                               $bid = $blog->getID();\r
-                                               if ($value === '1') $value = 'yes';\r
-                                               if ($value === '0') $value = 'no';\r
-                                               if ($plugin->getOption('AcceptPing') == 'no' ) {\r
-                                                       $condition = ($value == 'no');\r
-                                                       } else {\r
-                                                       $tb_option = $plugin->getBlogOption($bid,'AllowTrackBack');\r
-                                                       if (!$tb_option) {\r
-                                                               $condition = ($value == 'yes');\r
-                                                       } else {\r
-                                                               $condition = ($tb_option == $value);\r
-                                                       }\r
-                                               }\r
-                                       }\r
-                                       break;\r
-                               }\r
-                               $condition = ($blog && ($blog->getSetting($name) == $value));\r
-                               break;\r
-                       case 'loggedin':\r
-                               $condition = $member->isLoggedIn();\r
-                               break;\r
-                       case 'onteam':\r
-                               $condition = $member->isLoggedIn() && $this->_ifOnTeam($name);\r
-                               break;\r
-                       case 'admin':\r
-                               $condition = $member->isLoggedIn() && $this->_ifAdmin($name);\r
-                               break;                          \r
-                       case 'nextitem':\r
-                               $condition = ($itemidnext != '');\r
-                               break;\r
-                       case 'previtem':\r
-                               $condition = ($itemidprev != ''); \r
-                               break;\r
-                       case 'skintype':\r
-                               $condition = ($name == $this->skintype);\r
-                               break;\r
-                       /*\r
-                               hasplugin,PlugName\r
-                                       -> checks if plugin exists\r
-                               hasplugin,PlugName,OptionName\r
-                                       -> checks if the option OptionName from plugin PlugName is not set to 'no'\r
-                               hasplugin,PlugName,OptionName=value\r
-                                       -> checks if the option OptionName from plugin PlugName is set to value\r
-                       */\r
-                       case 'hasplugin':\r
-                $condition = false;\r
-                // (pluginInstalled method won't write a message in the actionlog on failure)\r
-                if ($manager->pluginInstalled('NP_'.$name)) \r
-                {\r
-                                       $plugin =& $manager->getPlugin('NP_' . $name);\r
-                                       if ($plugin != NULL){\r
-                                               if ($value == "") {\r
-                                                       $condition = true;\r
-                                               } else {\r
-                                                       list($name2, $value2) = explode('=', $value, 2);\r
-                                                       if ($value2 == "" && $plugin->getOption($name2) != 'no') {\r
-                                                               $condition = true;\r
-                                                       } else if ($plugin->getOption($name2) == $value2) {\r
-                                                               $condition = true;\r
-                                                       }\r
-                                               }\r
-                                       }\r
-                }\r
-                break;                         \r
-                       default:        \r
-                               return;\r
-               }\r
-               $this->_addIfCondition($condition);\r
-       }\r
-       \r
-       function _ifCategory($name = '', $value='') {\r
-               global $blog, $catid;\r
-\r
-               // when no parameter is defined, just check if a category is selected\r
-               if (($name != 'catname' && $name != 'catid') || ($value == ''))\r
-                       return $blog->isValidCategory($catid);\r
-\r
-               // check category name\r
-               if ($name == 'catname') {\r
-                       $value = $blog->getCategoryIdFromName($value);\r
-                       if ($value == $catid)\r
-                               return $blog->isValidCategory($catid);\r
-               }\r
-\r
-               // check category id\r
-               if (($name == 'catid') && ($value == $catid))\r
-                       return $blog->isValidCategory($catid);\r
-               \r
-               return false;\r
-       }\r
-   \r
-       function _ifOnTeam($blogName = '') {\r
-               global $blog, $member, $manager;\r
-               \r
-               // when no blog found\r
-               if (($blogName == '') && (!is_object($blog)))\r
-                       return 0;\r
-               \r
-               // explicit blog selection\r
-               if ($blogName != '') \r
-                       $blogid = getBlogIDFromName($blogName); \r
-               \r
-               if (($blogName == '') || !$manager->existsBlogID($blogid))\r
-                       // use current blog\r
-                       $blogid = $blog->getID();\r
-                       \r
-               return $member->teamRights($blogid);\r
-       }\r
-       \r
-       function _ifAdmin($blogName = '') {\r
-               global $blog, $member, $manager;\r
-\r
-               // when no blog found\r
-               if (($blogName == '') && (!is_object($blog)))\r
-                       return 0;\r
-\r
-               // explicit blog selection\r
-               if ($blogName != '')\r
-                       $blogid = getBlogIDFromName($blogName);\r
-\r
-               if (($blogName == '') || !$manager->existsBlogID($blogid))\r
-                       // use current blog\r
-                       $blogid = $blog->getID();\r
-\r
-               return $member->isBlogAdmin($blogid);\r
-       }       \r
-       \r
-       function parse_ifcat($text = '') {\r
-               if ($text == '') {\r
-                       // new behaviour\r
-                       $this->parse_if('category');\r
-               } else {\r
-                       // old behaviour\r
-                       global $catid, $blog;\r
-                       if ($blog->isValidCategory($catid))\r
-                               echo $text;\r
-               }\r
-       }\r
-       \r
-       // a link to the today page (depending on selected blog, etc...)\r
-       function parse_todaylink($linktext = '') {\r
-               global $blog, $CONF;\r
-               if ($blog)\r
-                       echo $this->_link(createBlogidLink($blog->getID(),$this->linkparams), $linktext);\r
-               else\r
-                       echo $this->_link($CONF['SiteUrl'], $linktext);\r
-       }\r
-       \r
-       // a link to the archives for the current blog (or for default blog)\r
-       function parse_archivelink($linktext = '') {\r
-               global $blog, $CONF;\r
-               if ($blog)\r
-                       echo $this->_link(createArchiveListLink($blog->getID(),$this->linkparams), $linktext);\r
-               else\r
-                       echo $this->_link(createArchiveListLink(), $linktext);\r
-       }\r
-\r
-       // include itemid of prev item\r
-       function parse_previtem() {\r
-               global $itemidprev;\r
-               echo $itemidprev;\r
-       }\r
-\r
-       // include itemtitle of prev item\r
-       function parse_previtemtitle() {\r
-               global $itemtitleprev;\r
-               echo htmlspecialchars($itemtitleprev);\r
-       }\r
-\r
-       // include itemid of next item\r
-       function parse_nextitem() {\r
-               global $itemidnext;\r
-               echo $itemidnext;\r
-       }\r
-\r
-       // include itemtitle of next item\r
-       function parse_nextitemtitle() {\r
-               global $itemtitlenext;\r
-               echo htmlspecialchars($itemtitlenext);\r
-       }\r
-\r
-       function parse_prevarchive() {\r
-               global $archiveprev;\r
-               echo $archiveprev;\r
-       }\r
-\r
-       function parse_nextarchive() {\r
-               global $archivenext;\r
-               echo $archivenext;\r
-       }\r
-\r
-       function parse_archivetype() {\r
-               global $archivetype;\r
-               echo $archivetype;\r
-       }\r
-\r
-       function parse_prevlink($linktext = '', $amount = 10) {\r
-               global $itemidprev, $archiveprev, $startpos;\r
-\r
-               if ($this->skintype == 'item')\r
-                       $this->_itemlink($itemidprev, $linktext);\r
-           else if ($this->skintype == 'search' || $this->skintype == 'index')\r
-               $this->_searchlink($amount, $startpos, 'prev', $linktext);\r
-               else\r
-                       $this->_archivelink($archiveprev, $linktext);\r
-       }\r
-       \r
-       function parse_nextlink($linktext = '', $amount = 10) {\r
-               global $itemidnext, $archivenext, $startpos;\r
-               if ($this->skintype == 'item')\r
-                       $this->_itemlink($itemidnext, $linktext);\r
-           else if ($this->skintype == 'search' || $this->skintype == 'index')\r
-               $this->_searchlink($amount, $startpos, 'next', $linktext);\r
-               else\r
-                       $this->_archivelink($archivenext, $linktext);\r
-       }\r
-       \r
-       /**\r
-        * returns either\r
-        *              - a raw link (html/xml encoded) when no linktext is provided\r
-        *              - a (x)html <a href... link when a text is present (text htmlencoded)\r
-        */\r
-       function _link($url, $linktext = '')\r
-       {\r
-               $u = htmlspecialchars($url);\r
-               $u = preg_replace("/&amp;amp;/",'&amp;',$u); // fix URLs that already had encoded ampersands\r
-               if ($linktext != '')\r
-                       $l = '<a href="' . $u .'">'.htmlspecialchars($linktext).'</a>';\r
-               else\r
-                       $l = $u;\r
-               return $l;      \r
-       }\r
-\r
-       /**\r
-        * Outputs a next/prev link\r
-        *\r
-        * @param $maxresults\r
-        *              The maximum amount of items shown per page (e.g. 10)\r
-        * @param $startpos\r
-        *              Current start position (requestVar('startpos'))\r
-        * @param $direction\r
-        *              either 'prev' or 'next'\r
-        * @param $linktext\r
-        *              When present, the output will be a full <a href...> link. When empty,\r
-        *              only a raw link will be outputted\r
-        */\r
-    function _searchlink($maxresults, $startpos, $direction, $linktext = '') {\r
-        global $CONF, $blog, $query, $amount;\r
-        // TODO: Move request uri to linkparams. this is ugly. sorry for that.\r
-        $startpos      = intval($startpos);            // will be 0 when empty. \r
-        $parsed                = parse_url(serverVar('REQUEST_URI'));\r
-        $parsed                = $parsed['query'];\r
-               $url            = '';\r
-        \r
-        switch ($direction) {\r
-            case 'prev':\r
-                if ( intval($startpos) - intval($maxresults) >= 0) {\r
-                    $startpos  = intval($startpos) - intval($maxresults);\r
-                    $url               = $CONF['SearchURL'].'?'.alterQueryStr($parsed,'startpos',$startpos);\r
-                }\r
-                break;\r
-            case 'next':\r
-                $iAmountOnPage = $this->amountfound;\r
-                if ($iAmountOnPage == 0)\r
-                {\r
-                       // [%nextlink%] or [%prevlink%] probably called before [%blog%] or [%searchresults%]\r
-                       // try a count query\r
-                       switch ($this->skintype)\r
-                       {\r
-                               case 'index':\r
-                                       $sqlquery = $blog->getSqlBlog('', 'count');\r
-                                       break;\r
-                               case 'search':\r
-                                       $sqlquery = $blog->getSqlSearch($query, $amount, $unused_highlight, 'count');\r
-                                       break;\r
-                       }\r
-                       if ($sqlquery) \r
-                               $iAmountOnPage = intval(quickQuery($sqlquery)) - intval($startpos);\r
-                }\r
-                if (intval($iAmountOnPage) >= intval($maxresults)) {\r
-                       $startpos       = intval($startpos) + intval($maxresults);                \r
-                       $url            = $CONF['SearchURL'].'?'.alterQueryStr($parsed,'startpos',$startpos);\r
-                }\r
-                break;\r
-            default:\r
-                break;\r
-        } // switch($direction)\r
-\r
-               if ($url != '')\r
-                       echo $this->_link($url, $linktext);        \r
-    }\r
-\r
-       function _itemlink($id, $linktext = '') {\r
-               global $CONF;\r
-               if ($id)\r
-                       echo $this->_link(createItemLink($id, $this->linkparams), $linktext);\r
-               else\r
-                       $this->parse_todaylink($linktext);\r
-       }\r
-\r
-       function _archivelink($id, $linktext = '') {\r
-               global $CONF, $blog;\r
-               if ($id)\r
-                       echo $this->_link(createArchiveLink($blog->getID(), $id, $this->linkparams), $linktext);\r
-               else\r
-                       $this->parse_todaylink($linktext);\r
-       }\r
-       \r
-       \r
-       function parse_itemlink($linktext = '') {       \r
-               $this->_itemlink($itemid, $linktext);\r
-       }\r
-       \r
-       /**\r
-         * %archivedate(locale,date format)%\r
-         */\r
-       function parse_archivedate($locale = '-def-') {\r
-               global $archive;\r
-               \r
-               if ($locale == '-def-')\r
-                       setlocale(LC_TIME,$template['LOCALE']);\r
-               else\r
-                       setlocale(LC_TIME,$locale);\r
-               \r
-               // get archive date\r
-               sscanf($archive,'%d-%d-%d',$y,$m,$d);\r
-\r
-               // get format           \r
-               $args = func_get_args();\r
-               // format can be spread over multiple parameters\r
-               if (sizeof($args) > 1) {\r
-                       // take away locale\r
-                       array_shift($args);\r
-                       // implode\r
-                       $format=implode(',',$args);\r
-               } elseif ($d == 0) {\r
-                       $format = '%B %Y';      \r
-               } else {\r
-                       $format = '%d %B %Y';   \r
-               }\r
-               \r
-               echo strftime($format,mktime(0,0,0,$m,$d?$d:1,$y));             \r
-       }\r
-       \r
-       function parse_blog($template, $amount = 10, $category = '') {\r
-               global $blog, $startpos;\r
-               \r
-               list($limit, $offset) = sscanf($amount, '%d(%d)');\r
-               $this->_setBlogCategory($blog, $category);\r
-               $this->_preBlogContent('blog',$blog);\r
-               $this->amountfound = $blog->readLog($template, $limit, $offset, $startpos);\r
-               $this->_postBlogContent('blog',$blog);\r
-       }\r
-\r
-       function parse_otherblog($blogname, $template, $amount = 10, $category = '') {\r
-               global $manager;\r
-\r
-               list($limit, $offset) = sscanf($amount, '%d(%d)');\r
-\r
-               $b =& $manager->getBlog(getBlogIDFromName($blogname));\r
-               $this->_setBlogCategory($b, $category);\r
-               $this->_preBlogContent('otherblog',$b);\r
-               $this->amountfound = $b->readLog($template, $limit, $offset);\r
-               $this->_postBlogContent('otherblog',$b);\r
-       }\r
-\r
-       // include one item (no comments)\r
-       function parse_item($template) {\r
-               global $blog, $itemid, $highlight;\r
-               $this->_setBlogCategory($blog, '');     // need this to select default category\r
-               $this->_preBlogContent('item',$blog);\r
-               $r = $blog->showOneitem($itemid, $template, $highlight);\r
-               if ($r == 0)\r
-                       echo _ERROR_NOSUCHITEM;\r
-               $this->_postBlogContent('item',$blog);\r
-       }\r
-\r
-       function parse_itemid() {\r
-               global $itemid;\r
-               echo $itemid;\r
-       }\r
-\r
-\r
-       // include comments for one item\r
-       function parse_comments($template) {\r
-               global $itemid, $manager, $blog, $highlight;\r
-               $template =& $manager->getTemplate($template);\r
-\r
-               // create parser object & action handler\r
-               $actions =& new ITEMACTIONS($blog);\r
-               $parser =& new PARSER($actions->getDefinedActions(),$actions);\r
-               $actions->setTemplate($template);\r
-               $actions->setParser($parser);\r
-               $item = ITEM::getitem($itemid, 0, 0);\r
-               $actions->setCurrentItem($item);\r
-\r
-               $comments =& new COMMENTS($itemid);\r
-               $comments->setItemActions($actions);\r
-               $comments->showComments($template, -1, 1, $highlight);  // shows ALL comments\r
-       }\r
-\r
-       function parse_archive($template, $category = '') {\r
-               global $blog, $archive;\r
-               // can be used with either yyyy-mm or yyyy-mm-dd\r
-               sscanf($archive,'%d-%d-%d',$y,$m,$d);\r
-               $this->_setBlogCategory($blog, $category);\r
-               $this->_preBlogContent('achive',$blog);\r
-               $blog->showArchive($template, $y, $m, $d);\r
-               $this->_postBlogContent('achive',$blog);\r
-\r
-       }\r
-\r
-       function parse_otherarchive($blogname, $template, $category = '') {\r
-               global $archive, $manager;\r
-               sscanf($archive,'%d-%d-%d',$y,$m,$d);\r
-               $b =& $manager->getBlog(getBlogIDFromName($blogname));\r
-               $this->_setBlogCategory($b, $category);\r
-               $this->_preBlogContent('otherachive',$b);\r
-               $b->showArchive($template, $y, $m, $d);\r
-               $this->_postBlogContent('otherachive',$b);\r
-       }\r
-\r
-       function parse_archivelist($template, $category = 'all', $limit = 0) {\r
-               global $blog;\r
-               if ($category == 'all') $category = '';\r
-               $this->_preBlogContent('archivelist',$blog);\r
-               $this->_setBlogCategory($blog, $category);\r
-               $blog->showArchiveList($template, 'month', $limit);\r
-               $this->_postBlogContent('archivelist',$blog);\r
-       }\r
-\r
-       function parse_archivedaylist($template, $category = 'all', $limit = 0) {\r
-               global $blog;\r
-               if ($category == 'all') $category = '';\r
-               $this->_preBlogContent('archivelist',$blog);\r
-               $this->_setBlogCategory($blog, $category);\r
-               $blog->showArchiveList($template, 'day', $limit);\r
-               $this->_postBlogContent('archivelist',$blog);\r
-       }\r
-\r
-\r
-       function parse_itemtitle() {\r
-               global $manager, $itemid;\r
-               $item =& $manager->getItem($itemid,0,0);\r
-               echo htmlspecialchars(strip_tags($item['title']));\r
-       }\r
-\r
-       function parse_categorylist($template, $blogname = '') {\r
-               global $blog, $manager;\r
-\r
-               if ($blogname == '') {\r
-                       $this->_preBlogContent('categorylist',$blog);\r
-                       $blog->showCategoryList($template);\r
-                       $this->_postBlogContent('categorylist',$blog);\r
-               } else {\r
-                       $b =& $manager->getBlog(getBlogIDFromName($blogname));\r
-                       $this->_preBlogContent('categorylist',$b);\r
-                       $b->showCategoryList($template);\r
-                       $this->_postBlogContent('categorylist',$b);\r
-               }\r
-       }\r
-\r
-       function parse_category($type = 'name') {\r
-               global $catid, $blog;\r
-               if (!$blog->isValidCategory($catid))\r
-                       return;\r
-\r
-               switch($type) {\r
-                       case 'name':\r
-                               echo $blog->getCategoryName($catid);\r
-                               break;\r
-                       case 'desc':\r
-                               echo $blog->getCategoryDesc($catid);\r
-                               break;\r
-                       case 'id':\r
-                               echo $catid;\r
-                               break;\r
-               }\r
-       }\r
-\r
-       function parse_otherarchivelist($blogname, $template, $category = 'all', $limit = 0) {\r
-               global $manager;\r
-               if ($category == 'all') $category = '';\r
-               $b =& $manager->getBlog(getBlogIDFromName($blogname));\r
-               $this->_setBlogCategory($b, $category);\r
-               $this->_preBlogContent('otherarchivelist',$b);\r
-               $b->showArchiveList($template, 'month', $limit);\r
-               $this->_postBlogContent('otherarchivelist',$b);\r
-       }\r
-\r
-       function parse_otherarchivedaylist($blogname, $template, $category = 'all', $limit = 0) {\r
-               global $manager;\r
-               if ($category == 'all') $category = '';\r
-               $b =& $manager->getBlog(getBlogIDFromName($blogname));\r
-               $this->_setBlogCategory($b, $category);\r
-               $this->_preBlogContent('otherarchivelist',$b);\r
-               $b->showArchiveList($template, 'day', $limit);\r
-               $this->_postBlogContent('otherarchivelist',$b);\r
-       }\r
-\r
-       function parse_searchresults($template, $maxresults = 50 ) {\r
-               global $blog, $query, $amount, $startpos;\r
-\r
-               $this->_setBlogCategory($blog, '');     // need this to select default category\r
-               $this->_preBlogContent('searchresults',$blog);\r
-               $this->amountfound = $blog->search($query, $template, $amount, $maxresults, $startpos);\r
-               $this->_postBlogContent('searchresults',$blog);\r
-       }\r
-\r
-       function parse_othersearchresults($blogname, $template, $maxresults = 50) {\r
-               global $query, $amount, $manager, $startpos;\r
-               $b =& $manager->getBlog(getBlogIDFromName($blogname));\r
-               $this->_setBlogCategory($b, '');        // need this to select default category\r
-               $this->_preBlogContent('othersearchresults',$b);\r
-               $b->search($query, $template, $amount, $maxresults, $startpos);\r
-               $this->_postBlogContent('othersearchresults',$b);\r
-       }\r
-\r
-       // includes the search query\r
-       function parse_query() {\r
-               global $query;\r
-               echo htmlspecialchars($query);\r
-       }\r
-                       \r
-       // include nucleus versionnumber\r
-       function parse_version() {\r
-               global $nucleus;\r
-               echo 'Nucleus CMS ' . $nucleus['version'];\r
-       }\r
-       \r
-\r
-       function parse_errormessage() {\r
-               global $errormessage;\r
-               echo $errormessage;\r
-       }\r
-\r
-\r
-       function parse_imagetext() {                    \r
-               echo htmlspecialchars(requestVar('imagetext'));\r
-       }\r
-       \r
-       function parse_image($what = 'imgtag') {\r
-               global $CONF;\r
-\r
-               $imagetext      = htmlspecialchars(requestVar('imagetext'));\r
-               $imagepopup = requestVar('imagepopup');\r
-               $width          = intRequestVar('width');\r
-               $height         = intRequestVar('height');\r
-               $fullurl        = htmlspecialchars($CONF['MediaURL'] . $imagepopup);\r
-               \r
-               switch($what)\r
-               {\r
-                       case 'url':\r
-                               echo $fullurl;\r
-                               break;\r
-                       case 'width':\r
-                               echo $width;\r
-                               break;\r
-                       case 'height':\r
-                               echo $height;\r
-                               break;\r
-                       case 'caption':\r
-                       case 'text':                    \r
-                               echo $imagetext;\r
-                               break;\r
-                       case 'imgtag':\r
-                       default:\r
-                               echo "<img src=\"$fullurl\" width=\"$width\" height=\"$height\" alt=\"$imagetext\" title=\"$imagetext\" />";\r
-                               break;\r
-               }\r
-       }\r
-       \r
-       // When commentform is not used, to include a hidden field with itemid\r
-       function parse_vars() {\r
-               global $itemid;\r
-               echo '<input type="hidden" name="itemid" value="'.$itemid.'" />';\r
-       }\r
-       \r
-       // include a sitevar\r
-       function parse_sitevar($which) {\r
-               global $CONF;\r
-               switch($which) {\r
-                       case 'url':\r
-                               echo $CONF['IndexURL'];\r
-                               break;\r
-                       case 'name':\r
-                               echo $CONF['SiteName'];\r
-                               break;\r
-                       case 'admin':\r
-                               echo $CONF['AdminEmail'];\r
-                               break;\r
-                       case 'adminurl':\r
-                               echo $CONF['AdminURL'];\r
-               }                       \r
-       }\r
-       \r
-       // shortcut for admin url\r
-       function parse_adminurl() { $this->parse_sitevar('adminurl'); }\r
-       \r
-       function parse_blogsetting($which) {\r
-               global $blog;\r
-               switch($which) {\r
-                       case 'id':\r
-                               echo $blog->getID();\r
-                               break;\r
-                       case 'url':\r
-                               echo $blog->getURL();\r
-                               break;\r
-                       case 'name':\r
-                               echo $blog->getName();\r
-                               break;\r
-                       case 'desc':\r
-                               echo $blog->getDescription();\r
-                               break;\r
-                       case 'short':\r
-                               echo $blog->getShortName();\r
-                               break;                          \r
-               }       \r
-       }\r
-       \r
-       // includes a member info thingie\r
-       function parse_member($what) {\r
-               global $memberinfo, $member;\r
-               \r
-               // 1. only allow the member-details-page specific variables on member pages\r
-               if ($this->skintype == 'member') {\r
-\r
-                       switch($what) {\r
-                               case 'name':\r
-                                       echo $memberinfo->getDisplayName();\r
-                                       break;\r
-                               case 'realname':\r
-                                       echo $memberinfo->getRealName();\r
-                                       break;\r
-                               case 'notes':\r
-                                       echo $memberinfo->getNotes();\r
-                                       break;\r
-                               case 'url':\r
-                                       echo $memberinfo->getURL();\r
-                                       break;\r
-                               case 'email':\r
-                                       echo $memberinfo->getEmail();\r
-                                       break;\r
-                               case 'id':\r
-                                       echo $memberinfo->getID();\r
-                                       break;                                  \r
-                       }       \r
-               }\r
-               \r
-               // 2. the next bunch of options is available everywhere, as long as the user is logged in\r
-               if ($member->isLoggedIn())\r
-               {\r
-                       switch($what) {\r
-                               case 'yourname':\r
-                                       echo $member->getDisplayName();\r
-                                       break;\r
-                               case 'yourrealname':\r
-                                       echo $member->getRealName();\r
-                                       break;\r
-                               case 'yournotes':\r
-                                       echo $member->getNotes();\r
-                                       break;\r
-                               case 'yoururl':\r
-                                       echo $member->getURL();\r
-                                       break;\r
-                               case 'youremail':\r
-                                       echo $member->getEmail();\r
-                                       break;\r
-                               case 'yourid':\r
-                                       echo $member->getID();\r
-                                       break;                                                                  \r
-                       }       \r
-               }\r
-\r
-       }\r
-       \r
-       function parse_preview($template) {\r
-               global $blog, $CONF, $manager;\r
-               \r
-               $template =& $manager->getTemplate($template);\r
-               $row['body'] = '<span id="prevbody"></span>';\r
-               $row['title'] = '<span id="prevtitle"></span>';\r
-               $row['more'] = '<span id="prevmore"></span>';\r
-               $row['itemlink'] = '';\r
-               $row['itemid'] = 0; $row['blogid'] = $blog->getID();\r
-               echo TEMPLATE::fill($template['ITEM_HEADER'],$row);\r
-               echo TEMPLATE::fill($template['ITEM'],$row);\r
-               echo TEMPLATE::fill($template['ITEM_FOOTER'],$row);\r
-       }\r
-       \r
-       function parse_additemform() {\r
-               global $blog, $CONF;\r
-               $this->formdata = array(\r
-                       'adminurl' => htmlspecialchars($CONF['AdminURL']),\r
-                       'catid' => $blog->getDefaultCategory()\r
-               );\r
-               $blog->InsertJavaScriptInfo(); \r
-               $this->doForm('additemform');\r
-       }\r
-\r
-       /**\r
-         * Executes a plugin skinvar\r
-         *\r
-         * @param pluginName name of plugin (without the NP_)\r
-         * \r
-         * extra parameters can be added\r
-         */\r
-       function parse_plugin($pluginName) {\r
-               global $manager;\r
-               \r
-               // only continue when the plugin is really installed\r
-               if (!$manager->pluginInstalled('NP_' . $pluginName))\r
-                       return;\r
-               \r
-               $plugin =& $manager->getPlugin('NP_' . $pluginName);\r
-               if (!$plugin) return;\r
-\r
-               // get arguments\r
-               $params = func_get_args();\r
-               \r
-               // remove plugin name \r
-               array_shift($params);\r
-               \r
-               // add skin type on front\r
-               array_unshift($params, $this->skintype);\r
-               \r
-               call_user_func_array(array(&$plugin,'doSkinVar'), $params);\r
-       }\r
-\r
-                       \r
-       function parse_commentform($destinationurl = '') {\r
-               global $blog, $itemid, $member, $CONF, $manager, $DIR_LIBS, $errormessage;\r
-               \r
-               // warn when trying to provide a actionurl (used to be a parameter in Nucleus <2.0)\r
-               if (stristr($destinationurl, 'action.php')) {\r
-                       $args = func_get_args();\r
-                       $destinationurl = $args[1];\r
-                       ACTIONLOG::add(WARNING,'actionurl is not longer a parameter on commentform skinvars. Moved to be a global setting instead.');\r
-               }\r
-               \r
-               $actionurl = $CONF['ActionURL'];\r
-               \r
-               // if item is closed, show message and do nothing\r
-               $item =& $manager->getItem($itemid,0,0);\r
-               if ($item['closed'] || !$blog->commentsEnabled()) {\r
-                       $this->doForm('commentform-closed');\r
-                       return;\r
-               }\r
-               \r
-               if (!$destinationurl)\r
-                       $destinationurl = createItemLink($itemid, $this->linkparams);\r
-\r
-               // values to prefill\r
-               $user = cookieVar($CONF['CookiePrefix'] .'comment_user');\r
-               if (!$user) $user = postVar('user');\r
-               $userid = cookieVar($CONF['CookiePrefix'] .'comment_userid');\r
-               if (!$userid) $userid = postVar('userid');\r
-               $body = postVar('body');\r
-               \r
-               $this->formdata = array(\r
-                       'destinationurl' => htmlspecialchars($destinationurl),\r
-                       'actionurl' => htmlspecialchars($actionurl),\r
-                       'itemid' => $itemid,\r
-                       'user' => htmlspecialchars($user),\r
-                       'userid' => htmlspecialchars($userid),                  \r
-                       'body' => htmlspecialchars($body),                      \r
-                       'membername' => $member->getDisplayName(),\r
-                       'rememberchecked' => cookieVar($CONF['CookiePrefix'] .'comment_user')?'checked="checked"':''\r
-               );\r
-               \r
-               if (!$member->isLoggedIn()) {\r
-                       $this->doForm('commentform-notloggedin');\r
-               } else {\r
-                       $this->doForm('commentform-loggedin');          \r
-               }\r
-       }\r
-\r
-       function parse_loginform() {\r
-               global $member, $CONF;\r
-               if (!$member->isLoggedIn()) {\r
-                       $filename = 'loginform-notloggedin';\r
-                       $this->formdata = array();\r
-               } else {\r
-                       $filename = 'loginform-loggedin';\r
-                       $this->formdata = array(\r
-                               'membername' => $member->getDisplayName(),\r
-                       );\r
-               }\r
-               $this->doForm($filename);\r
-       }       \r
-       \r
-       \r
-       function parse_membermailform($rows = 10, $cols = 40, $desturl = '') {\r
-               global $member, $CONF, $memberid;\r
-               \r
-               if ($desturl == '') {\r
-                       if ($CONF['URLMode'] == 'pathinfo')\r
-                               $desturl = createMemberLink($memberid);\r
-                       else\r
-                               $desturl = $CONF['IndexURL'] . createMemberLink($memberid);                             \r
-               }\r
-                       \r
-               $message = postVar('message');\r
-               $frommail = postVar('frommail');\r
-               \r
-               $this->formdata = array(\r
-                       'url' => htmlspecialchars($desturl),\r
-                       'actionurl' => htmlspecialchars($CONF['ActionURL']),\r
-                       'memberid' => $memberid,\r
-                       'rows' => $rows,\r
-                       'cols' => $cols,\r
-                       'message' => htmlspecialchars($message),\r
-                       'frommail' => htmlspecialchars($frommail)\r
-               );\r
-               if ($member->isLoggedIn()) {\r
-                       $this->doForm('membermailform-loggedin');\r
-               } else if ($CONF['NonmemberMail']) {\r
-                       $this->doForm('membermailform-notloggedin');            \r
-               } else {\r
-                       $this->doForm('membermailform-disallowed');             \r
-               }\r
-\r
-       }\r
-\r
-       function parse_searchform($blogname = '') {\r
-               global $CONF, $manager, $maxresults;\r
-               if ($blogname) {\r
-                       $blog =& $manager->getBlog(getBlogIDFromName($blogname));\r
-               } else {\r
-                       global $blog;\r
-               }\r
-               // use default blog when no blog is selected\r
-               $this->formdata = array(\r
-                       'id' => $blog?$blog->getID():$CONF['DefaultBlog'],\r
-                       'query' => htmlspecialchars(getVar('query')),\r
-               );\r
-               $this->doForm('searchform');\r
-       }\r
-\r
-       function parse_nucleusbutton($imgurl = '',\r
-                                                            $imgwidth = '85',\r
-                                                            $imgheight = '31') {\r
-               global $CONF;\r
-               if ($imgurl == '') {\r
-                       $imgurl = $CONF['AdminURL'] . 'nucleus.gif';\r
-               } else if (PARSER::getProperty('IncludeMode') == 'skindir'){\r
-                       // when skindit IncludeMode is used: start from skindir\r
-                       $imgurl = $CONF['SkinsURL'] . PARSER::getProperty('IncludePrefix') . $imgurl;\r
-               }\r
-\r
-               $this->formdata = array(\r
-                       'imgurl' => $imgurl,\r
-                       'imgwidth' => $imgwidth,\r
-                       'imgheight' => $imgheight,\r
-               );\r
-               $this->doForm('nucleusbutton');\r
-       }\r
-       \r
-       function parse_self() {\r
-               global $CONF;\r
-               echo $CONF['Self'];\r
-       }\r
-       \r
-       function parse_referer() {\r
-               echo htmlspecialchars(serverVar('HTTP_REFERER'));\r
-       }\r
-       \r
-       /**\r
-         * Helper function that sets the category that a blog will need to use \r
-         *\r
-         * @param $blog\r
-         *             An object of the blog class, passed by reference (we want to make changes to it)\r
-         * @param $catname\r
-         *             The name of the category to use\r
-         */\r
-       function _setBlogCategory(&$blog, $catname) {\r
-               global $catid;\r
-               if ($catname != '')\r
-                       $blog->setSelectedCategoryByName($catname);\r
-               else\r
-                       $blog->setSelectedCategory($catid);\r
-       }\r
-       \r
-       function _preBlogContent($type, &$blog) {\r
-               global $manager;\r
-               $manager->notify('PreBlogContent',array('blog' => &$blog, 'type' => $type));\r
-       }\r
-\r
-       function _postBlogContent($type, &$blog) {\r
-               global $manager;\r
-               $manager->notify('PostBlogContent',array('blog' => &$blog, 'type' => $type));\r
-       }\r
-\r
-}\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)
+ */
+
+/**
+ * Class representing a skin
+ *
+ * @license http://nucleuscms.org/license.txt GNU General Public License
+ * @copyright Copyright (C) 2002-2007 The Nucleus Group
+ * @version $Id: SKIN.php,v 1.6 2007-03-22 09:23:58 kimitake Exp $
+ * @version $NucleusJP: SKIN.php,v 1.8 2007/03/20 19:31:29 kmorimatsu Exp $
+ */
+
+if ( !function_exists('requestVar') ) exit;
+require_once dirname(__FILE__) . '/ACTIONS.php';
+
+class SKIN {
+
+       // after creating a SKIN object, evaluates to true when the skin exists
+       var $isValid;
+
+       // skin characteristics. Use the getXXX methods rather than accessing directly
+       var $id;
+       var $description;
+       var $contentType;
+       var $includeMode;               // either 'normal' or 'skindir'
+       var $includePrefix;
+       var $name;
+
+       function SKIN($id) {
+               $this->id = intval($id);
+
+               // read skin name/description/content type
+               $res = sql_query('SELECT * FROM '.sql_table('skin_desc').' WHERE sdnumber=' . $this->id);
+               $obj = mysql_fetch_object($res);
+               $this->isValid = (mysql_num_rows($res) > 0);
+               if (!$this->isValid)
+                       return;
+
+               $this->name = $obj->sdname;
+               $this->description = $obj->sddesc;
+               $this->contentType = $obj->sdtype;
+               $this->includeMode = $obj->sdincmode;
+               $this->includePrefix = $obj->sdincpref;
+
+       }
+
+       function getID() {                              return $this->id; }
+       function getName() {                    return $this->name; }
+       function getDescription() {     return $this->description; }
+       function getContentType() {     return $this->contentType; }
+       function getIncludeMode() {     return $this->includeMode; }
+       function getIncludePrefix() {   return $this->includePrefix; }
+
+       /**
+        * Checks if a skin with a given shortname exists
+        * @param string $name Skin short name
+        * @return int number of skins with the given ID
+        * @static
+        */
+       function exists($name) {
+               return quickQuery('select count(*) as result FROM '.sql_table('skin_desc').' WHERE sdname="'.addslashes($name).'"') > 0;
+       }
+
+       /**
+        * Checks if a skin with a given ID exists
+        * @param string $id Skin ID
+        * @return int number of skins with the given ID
+        * @static
+        */
+       function existsID($id) {
+               return quickQuery('select COUNT(*) as result FROM '.sql_table('skin_desc').' WHERE sdnumber='.intval($id)) > 0;
+       }
+
+       /**
+        * Returns a skin given its shortname
+        * @param string $name Skin shortname
+        * @return object SKIN
+        * @static
+        */
+       function createFromName($name) {
+               return new SKIN(SKIN::getIdFromName($name));
+       }
+
+       /**
+        * Returns a skin ID given its shortname
+        * @param string $name Skin shortname
+        * @return int Skin ID
+        * @static
+        */
+       function getIdFromName($name) {
+               $query =  'SELECT sdnumber'
+                          . ' FROM '.sql_table('skin_desc')
+                          . ' WHERE sdname="'.addslashes($name).'"';
+               $res = sql_query($query);
+               $obj = mysql_fetch_object($res);
+               return $obj->sdnumber;
+       }
+
+       /**
+        * Returns a skin shortname given its ID
+        * @param string $name
+        * @return string Skin short name
+        * @static
+        */
+       function getNameFromId($id) {
+               return quickQuery('SELECT sdname as result FROM '.sql_table('skin_desc').' WHERE sdnumber=' . intval($id));
+       }
+
+       /**
+        * Creates a new skin, with the given characteristics.
+        *
+        * @static
+        */
+       function createNew($name, $desc, $type = 'text/html', $includeMode = 'normal', $includePrefix = '') {
+               global $manager;
+
+               $manager->notify(
+                       'PreAddSkin',
+                       array(
+                               'name' => &$name,
+                               'description' => &$desc,
+                               'type' => &$type,
+                               'includeMode' => &$includeMode,
+                               'includePrefix' => &$includePrefix
+                       )
+               );
+
+               sql_query('INSERT INTO '.sql_table('skin_desc')." (sdname, sddesc, sdtype, sdincmode, sdincpref) VALUES ('" . addslashes($name) . "','" . addslashes($desc) . "','".addslashes($type)."','".addslashes($includeMode)."','".addslashes($includePrefix)."')");
+               $newid = mysql_insert_id();
+
+               $manager->notify(
+                       'PostAddSkin',
+                       array(
+                               'skinid' => $newid,
+                               'name' => $name,
+                               'description' => $desc,
+                               'type' => $type,
+                               'includeMode' => $includeMode,
+                               'includePrefix' => $includePrefix
+                       )
+               );
+
+               return $newid;
+       }
+
+       function parse($type) {
+               global $manager, $CONF;
+
+               $manager->notify('InitSkinParse',array('skin' => &$this, 'type' => $type));
+
+               // set output type
+               sendContentType($this->getContentType(), 'skin', _CHARSET);
+
+               // set skin name as global var (so plugins can access it)
+               global $currentSkinName;
+               $currentSkinName = $this->getName();
+
+               $contents = $this->getContent($type);
+
+               if (!$contents) {
+                       // use base skin if this skin does not have contents
+                       $defskin =& new SKIN($CONF['BaseSkin']);
+                       $contents = $defskin->getContent($type);
+                       if (!$contents) {
+                               echo _ERROR_SKIN;
+                               return;
+                       }
+               }
+
+               $actions = $this->getAllowedActionsForType($type);
+
+               $manager->notify('PreSkinParse',array('skin' => &$this, 'type' => $type, 'contents' => &$contents));
+
+               // set IncludeMode properties of parser
+               PARSER::setProperty('IncludeMode',$this->getIncludeMode());
+               PARSER::setProperty('IncludePrefix',$this->getIncludePrefix());
+
+               $handler =& new ACTIONS($type, $this);
+               $parser =& new PARSER($actions, $handler);
+               $handler->setParser($parser);
+               $handler->setSkin($this);
+               $parser->parse($contents);
+
+               $manager->notify('PostSkinParse',array('skin' => &$this, 'type' => $type));
+
+
+       }
+
+       function getContent($type) {
+               $query = 'SELECT scontent FROM '.sql_table('skin')." WHERE sdesc=$this->id and stype='". addslashes($type) ."'";
+               $res = sql_query($query);
+
+               if (mysql_num_rows($res) == 0)
+                       return '';
+               else
+                       return mysql_result($res, 0, 0);
+       }
+
+       /**
+        * Updates the contents of one part of the skin
+        */
+       function update($type, $content) {
+               $skinid = $this->id;
+
+               // delete old thingie
+               sql_query('DELETE FROM '.sql_table('skin')." WHERE stype='".addslashes($type)."' and sdesc=" . intval($skinid));
+
+               // write new thingie
+               if ($content) {
+                       sql_query('INSERT INTO '.sql_table('skin')." SET scontent='" . addslashes($content) . "', stype='" . addslashes($type) . "', sdesc=" . intval($skinid));
+               }
+       }
+
+       /**
+        * Deletes all skin parts from the database
+        */
+       function deleteAllParts() {
+               sql_query('DELETE FROM '.sql_table('skin').' WHERE sdesc='.$this->getID());
+       }
+
+       /**
+        * Updates the general information about the skin
+        */
+       function updateGeneralInfo($name, $desc, $type = 'text/html', $includeMode = 'normal', $includePrefix = '') {
+               $query =  'UPDATE '.sql_table('skin_desc').' SET'
+                          . " sdname='" . addslashes($name) . "',"
+                          . " sddesc='" . addslashes($desc) . "',"
+                          . " sdtype='" . addslashes($type) . "',"
+                          . " sdincmode='" . addslashes($includeMode) . "',"
+                          . " sdincpref='" . addslashes($includePrefix) . "'"
+                          . " WHERE sdnumber=" . $this->getID();
+               sql_query($query);
+       }
+
+       /**
+        * static: returns an array of friendly names
+        */
+       function getFriendlyNames() {
+               $skintypes = array(
+                       'index' => _SKIN_PART_MAIN,
+                       'item' => _SKIN_PART_ITEM,
+                       'archivelist' => _SKIN_PART_ALIST,
+                       'archive' => _SKIN_PART_ARCHIVE,
+                       'search' => _SKIN_PART_SEARCH,
+                       'error' => _SKIN_PART_ERROR,
+                       'member' => _SKIN_PART_MEMBER,
+                       'imagepopup' => _SKIN_PART_POPUP
+               );
+
+               $query = "SELECT stype FROM " . sql_table('skin') . " WHERE stype NOT IN ('index', 'item', 'error', 'search', 'archive', 'archivelist', 'imagepopup', 'member')";
+               $res = sql_query($query);
+               while ($row = mysql_fetch_array($res)) {
+                       $skintypes[strtolower($row['stype'])] = ucfirst($row['stype']);
+               }
+
+               return $skintypes;
+       }
+
+       function getAllowedActionsForType($type) {
+               global $blogid;
+
+               // some actions that can be performed at any time, from anywhere
+               $defaultActions = array('otherblog',
+                                                               'plugin',
+                                                               'version',
+                                                               'nucleusbutton',
+                                                               'include',
+                                                               'phpinclude',
+                                                               'parsedinclude',
+                                                               'loginform',
+                                                               'sitevar',
+                                                               'otherarchivelist',
+                                                               'otherarchivedaylist',
+                                                               'self',
+                                                               'adminurl',
+                                                               'todaylink',
+                                                               'archivelink',
+                                                               'member',
+                                                               'ifcat',                                        // deprecated (Nucleus v2.0)
+                                                               'category',
+                                                               'searchform',
+                                                               'referer',
+                                                               'skinname',
+                                                               'skinfile',
+                                                               'set',
+                                                               'if',
+                                                               'else',
+                                                               'endif',
+                                                               'elseif',
+                                                               'ifnot',
+                                                               'elseifnot',
+                                                               'charset',
+                                                               'bloglist'
+                                                               );
+
+               // extra actions specific for a certain skin type
+               $extraActions = array();
+
+               switch ($type) {
+                       case 'index':
+                               $extraActions = array('blog',
+                                                               'blogsetting',
+                                                               'preview',
+                                                               'additemform',
+                                                               'categorylist',
+                                                               'archivelist',
+                                                               'archivedaylist',
+                                                               'nextlink',
+                                                               'prevlink'
+                                                               );
+                               break;
+                       case 'archive':
+                               $extraActions = array('blog',
+                                                               'archive',
+                                                               'otherarchive',
+                                                               'categorylist',
+                                                               'archivelist',
+                                                               'archivedaylist',
+                                                               'blogsetting',
+                                                               'archivedate',
+                                                               'nextarchive',
+                                                               'prevarchive',
+                                                               'nextlink',
+                                                               'prevlink',
+                                                               'archivetype'
+                               );
+                               break;
+                       case 'archivelist':
+                               $extraActions = array('blog',
+                                                               'archivelist',
+                                                               'archivedaylist',
+                                                               'categorylist',
+                                                               'blogsetting',
+                                                          );
+                               break;
+                       case 'search':
+                               $extraActions = array('blog',
+                                                               'archivelist',
+                                                               'archivedaylist',
+                                                               'categorylist',
+                                                               'searchresults',
+                                                               'othersearchresults',
+                                                               'blogsetting',
+                                                               'query',
+                                                               'nextlink',
+                                                               'prevlink'
+                                                               );
+                               break;
+                       case 'imagepopup':
+                               $extraActions = array('image',
+                                                               'imagetext',                            // deprecated (Nucleus v2.0)
+                                                               );
+                               break;
+                       case 'member':
+                               $extraActions = array(
+                                                               'membermailform',
+                                                               'blogsetting',
+                                                               'nucleusbutton'
+                               );
+                               break;
+                       case 'item':
+                               $extraActions = array('blog',
+                                                               'item',
+                                                               'comments',
+                                                               'commentform',
+                                                               'vars',
+                                                               'blogsetting',
+                                                               'nextitem',
+                                                               'previtem',
+                                                               'nextlink',
+                                                               'prevlink',
+                                                               'nextitemtitle',
+                                                               'previtemtitle',
+                                                               'categorylist',
+                                                               'archivelist',
+                                                               'archivedaylist',
+                                                               'itemtitle',
+                                                               'itemid',
+                                                               'itemlink',
+                                                               );
+                               break;
+                       case 'error':
+                               $extraActions = array(
+                                                               'errormessage'
+                               );
+                               break;
+                       default:
+                               if ($blogid && $blogid > 0) {
+                                       $extraActions = array(
+                                               'blog',
+                                               'blogsetting',
+                                               'preview',
+                                               'additemform',
+                                               'categorylist',
+                                               'archivelist',
+                                               'archivedaylist',
+                                               'nextlink',
+                                               'archivelist',
+                                               'archivedaylist',
+                                               'prevlink',
+                                               'membermailform',
+                                               'nucleusbutton'
+                                       );
+                               }
+                               break;
+               }
+
+               return array_merge($defaultActions, $extraActions);
+       }
+
+}
+
+?>
index 23a4481..66c1984 100755 (executable)
-<?php\r
-\r
-/**\r
-  * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/) \r
-  * Copyright (C) 2002-2005 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
-  * A class representing a template\r
-  *\r
-  * $Id: TEMPLATE.php,v 1.3 2005-03-16 08:10:35 kimitake Exp $\r
-  * $NucleusJP: TEMPLATE.php,v 1.3 2005/03/12 06:19:05 kimitake Exp $\r
-  */\r
-class TEMPLATE {\r
-\r
-       var $id;\r
-       \r
-       function TEMPLATE($templateid) {\r
-               $this->id = intval($templateid);\r
-       }\r
-       \r
-       function getID() {\r
-               return intval($this->id);\r
-       }\r
-       \r
-       // (static)\r
-       function createFromName($name) {\r
-               return new TEMPLATE(TEMPLATE::getIdFromName($name));\r
-       }\r
-       \r
-       // (static)\r
-       function getIdFromName($name) {\r
-               $query =  'SELECT tdnumber'\r
-                      . ' FROM '.sql_table('template_desc')\r
-                      . ' WHERE tdname="'.addslashes($name).'"';\r
-               $res = sql_query($query);\r
-               $obj = mysql_fetch_object($res);\r
-               return $obj->tdnumber;  \r
-       }\r
-\r
-       /**\r
-        * Updates the general information about the template\r
-        */\r
-       function updateGeneralInfo($name, $desc) {\r
-               $query =  'UPDATE '.sql_table('template_desc').' SET'\r
-                      . " tdname='" . addslashes($name) . "',"\r
-                      . " tddesc='" . addslashes($desc) . "'"\r
-                      . " WHERE tdnumber=" . $this->getID();\r
-               sql_query($query);              \r
-       }\r
-       \r
-       /**\r
-        * Updates the contents of one part of the template\r
-        */\r
-       function update($type, $content) {\r
-               $id = $this->getID();\r
-       \r
-               // delete old thingie\r
-               sql_query('DELETE FROM '.sql_table('template')." WHERE tpartname='". addslashes($type) ."' and tdesc=" . intval($id));\r
-               \r
-               // write new thingie\r
-               if ($content) {\r
-                       sql_query('INSERT INTO '.sql_table('template')." SET tcontent='" . addslashes($content) . "', tpartname='" . addslashes($type) . "', tdesc=" . intval($id));\r
-               }       \r
-       }\r
-               \r
-\r
-       /**\r
-        * Deletes all template parts from the database\r
-        */\r
-       function deleteAllParts() {\r
-               sql_query('DELETE FROM '.sql_table('template').' WHERE tdesc='.$this->getID());\r
-       }\r
-\r
-       /**\r
-        * Creates a new template\r
-        *\r
-        * (static)\r
-        */\r
-       function createNew($name, $desc) {\r
-               global $manager;\r
-               \r
-               $manager->notify(\r
-                       'PreAddTemplate',\r
-                       array(\r
-                               'name' => &$name,\r
-                               'description' => &$desc\r
-                       )\r
-               );\r
-               \r
-               sql_query('INSERT INTO '.sql_table('template_desc')." (tdname, tddesc) VALUES ('" . addslashes($name) . "','" . addslashes($desc) . "')");\r
-               $newId = mysql_insert_id();\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
-\r
-       /**\r
-        * Reads a template and returns an array with the parts.\r
-        * (static)\r
-        *\r
-        * @param $name name of the template file\r
-        */\r
-       function read($name) {\r
-               $query = 'SELECT tpartname, tcontent'\r
-                      . ' FROM '.sql_table('template_desc').', '.sql_table('template')\r
-                      . ' WHERE tdesc=tdnumber and tdname="' . addslashes($name) . '"';\r
-               $res = sql_query($query);\r
-               while ($obj = mysql_fetch_object($res)) \r
-                       $template[$obj->tpartname] = $obj->tcontent;\r
-               \r
-               // set locale according to template:\r
-               if ($template['LOCALE'])\r
-                       setlocale(LC_TIME,$template['LOCALE']);\r
-               else\r
-                       setlocale(LC_TIME,'');  \r
-                       \r
-               return $template;\r
-       }\r
-       \r
-       /**\r
-         * fills a template with values\r
-         * (static)\r
-         *\r
-         * @param $template \r
-         *             Template to be used\r
-         * @param $values\r
-         *             Array of all the values \r
-         */\r
-       function fill($template, $values) {\r
-\r
-               if (sizeof($values) != 0) {\r
-                       // go through all the values\r
-                       for(reset($values); $key = key($values); next($values)) {\r
-                               $template = str_replace("<%$key%>",$values[$key],$template);\r
-                       }\r
-               }\r
-\r
-               // remove non matched template-tags\r
-               return preg_replace('/<%[a-zA-Z]+%>/','',$template);\r
-       }       \r
-       \r
-       // returns true if there is a template with the given shortname\r
-       // (static)\r
-       function exists($name) {\r
-               $r = sql_query('select * FROM '.sql_table('template_desc').' WHERE tdname="'.addslashes($name).'"');\r
-               return (mysql_num_rows($r) != 0);\r
-       }\r
-       \r
-       // returns true if there is a template with the given ID\r
-       // (static)\r
-       function existsID($id) {\r
-               $r = sql_query('select * FROM '.sql_table('template_desc').' WHERE tdnumber='.intval($id));\r
-               return (mysql_num_rows($r) != 0);\r
-       }\r
-       \r
-       // (static)\r
-       function getNameFromId($id) {\r
-               return quickQuery('SELECT tdname as result FROM '.sql_table('template_desc').' WHERE tdnumber=' . intval($id));\r
-       }\r
-       \r
-       // (static)\r
-       function getDesc($id) {\r
-               $query = 'SELECT tddesc FROM '.sql_table('template_desc').' WHERE tdnumber='. intval($id);\r
-               $obj = mysql_fetch_object(sql_query($query));\r
-               return $obj->tddesc;\r
-       }\r
-       \r
-\r
-       \r
-}\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 template
+ *
+ * @license http://nucleuscms.org/license.txt GNU General Public License
+ * @copyright Copyright (C) 2002-2007 The Nucleus Group
+ * @version $Id: TEMPLATE.php,v 1.4 2007-03-22 09:23:58 kimitake Exp $
+ * @version $NucleusJP: TEMPLATE.php,v 1.7 2007/02/04 06:28:46 kimitake Exp $
+ */
+class TEMPLATE {
+
+       var $id;
+
+       function TEMPLATE($templateid) {
+               $this->id = intval($templateid);
+       }
+
+       function getID() {
+               return intval($this->id);
+       }
+
+       // (static)
+       function createFromName($name) {
+               return new TEMPLATE(TEMPLATE::getIdFromName($name));
+       }
+
+       // (static)
+       function getIdFromName($name) {
+               $query =  'SELECT tdnumber'
+                          . ' FROM '.sql_table('template_desc')
+                          . ' WHERE tdname="'.addslashes($name).'"';
+               $res = sql_query($query);
+               $obj = mysql_fetch_object($res);
+               return $obj->tdnumber;
+       }
+
+       /**
+        * Updates the general information about the template
+        */
+       function updateGeneralInfo($name, $desc) {
+               $query =  'UPDATE '.sql_table('template_desc').' SET'
+                          . " tdname='" . addslashes($name) . "',"
+                          . " tddesc='" . addslashes($desc) . "'"
+                          . " WHERE tdnumber=" . $this->getID();
+               sql_query($query);
+       }
+
+       /**
+        * Updates the contents of one part of the template
+        */
+       function update($type, $content) {
+               $id = $this->getID();
+
+               // delete old thingie
+               sql_query('DELETE FROM '.sql_table('template')." WHERE tpartname='". addslashes($type) ."' and tdesc=" . intval($id));
+
+               // write new thingie
+               if ($content) {
+                       sql_query('INSERT INTO '.sql_table('template')." SET tcontent='" . addslashes($content) . "', tpartname='" . addslashes($type) . "', tdesc=" . intval($id));
+               }
+       }
+
+
+       /**
+        * Deletes all template parts from the database
+        */
+       function deleteAllParts() {
+               sql_query('DELETE FROM '.sql_table('template').' WHERE tdesc='.$this->getID());
+       }
+
+       /**
+        * Creates a new template
+        *
+        * (static)
+        */
+       function createNew($name, $desc) {
+               global $manager;
+
+               $manager->notify(
+                       'PreAddTemplate',
+                       array(
+                               'name' => &$name,
+                               'description' => &$desc
+                       )
+               );
+
+               sql_query('INSERT INTO '.sql_table('template_desc')." (tdname, tddesc) VALUES ('" . addslashes($name) . "','" . addslashes($desc) . "')");
+               $newId = mysql_insert_id();
+
+               $manager->notify(
+                       'PostAddTemplate',
+                       array(
+                               'templateid' => $newId,
+                               'name' => $name,
+                               'description' => $desc
+                       )
+               );
+
+               return $newId;
+       }
+
+
+
+       /**
+        * Reads a template and returns an array with the parts.
+        * (static)
+        *
+        * @param $name name of the template file
+        */
+       function read($name) {
+               $query = 'SELECT tpartname, tcontent'
+                          . ' FROM '.sql_table('template_desc').', '.sql_table('template')
+                          . ' WHERE tdesc=tdnumber and tdname="' . addslashes($name) . '"';
+               $res = sql_query($query);
+               while ($obj = mysql_fetch_object($res))
+                       $template[$obj->tpartname] = $obj->tcontent;
+
+               // set locale according to template:
+               if ($template['LOCALE'])
+                       setlocale(LC_TIME,$template['LOCALE']);
+               else
+                       setlocale(LC_TIME,'');
+
+               return $template;
+       }
+
+       /**
+         * fills a template with values
+         * (static)
+         *
+         * @param $template
+         *             Template to be used
+         * @param $values
+         *             Array of all the values
+         */
+       function fill($template, $values) {
+
+               if (sizeof($values) != 0) {
+                       // go through all the values
+                       for(reset($values); $key = key($values); next($values)) {
+                               $template = str_replace("<%$key%>",$values[$key],$template);
+                       }
+               }
+
+               // remove non matched template-tags
+               return preg_replace('/<%[a-zA-Z]+%>/','',$template);
+       }
+
+       // returns true if there is a template with the given shortname
+       // (static)
+       function exists($name) {
+               $r = sql_query('select * FROM '.sql_table('template_desc').' WHERE tdname="'.addslashes($name).'"');
+               return (mysql_num_rows($r) != 0);
+       }
+
+       // returns true if there is a template with the given ID
+       // (static)
+       function existsID($id) {
+               $r = sql_query('select * FROM '.sql_table('template_desc').' WHERE tdnumber='.intval($id));
+               return (mysql_num_rows($r) != 0);
+       }
+
+       // (static)
+       function getNameFromId($id) {
+               return quickQuery('SELECT tdname as result FROM '.sql_table('template_desc').' WHERE tdnumber=' . intval($id));
+       }
+
+       // (static)
+       function getDesc($id) {
+               $query = 'SELECT tddesc FROM '.sql_table('template_desc').' WHERE tdnumber='. intval($id);
+               $res = sql_query($query);
+               $obj = mysql_fetch_object($res);
+               return $obj->tddesc;
+       }
+
+
+
+}
+
+?>
\ No newline at end of file
index f9167d8..7a2b30b 100755 (executable)
-<?php\r
-/**\r
-  * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/) \r
-  * Copyright (C) 2002-2005 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 class contains two classes that can be used for importing and \r
-  *    exporting Nucleus skins: SKINIMPORT and SKINEXPORT\r
-  *\r
-  * $Id: skinie.php,v 1.3 2005-03-16 08:10:35 kimitake Exp $\r
-  * $NucleusJP: skinie.php,v 1.3 2005/03/12 06:19:05 kimitake Exp $\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
-       var $debug;\r
-       \r
-       // parser/file pointer\r
-       var $parser;\r
-       var $fp;\r
-       \r
-       // which data has been read?\r
-       var $metaDataRead;\r
-       var $allRead;   \r
-       \r
-       // extracted data\r
-       var $skins;\r
-       var $templates;\r
-       var $info;\r
-       \r
-       // to maintain track of where we are inside the XML file\r
-       var $inXml;\r
-       var $inData;\r
-       var $inMeta;\r
-       var $inSkin;\r
-       var $inTemplate;\r
-       var $currentName;\r
-       var $currentPartName;\r
-       var $cdata;     \r
-       \r
-       \r
-       \r
-       /**\r
-        * constructor initializes data structures\r
-        */\r
-       function SKINIMPORT() {\r
-               // disable magic_quotes_runtime if it's turned on\r
-               set_magic_quotes_runtime(0);\r
-       \r
-               // debugging mode?\r
-               $this->debug = 0;\r
-       \r
-               $this->reset();\r
-               \r
-       }\r
-       \r
-       function reset() {\r
-       if ($this->parser)\r
-               xml_parser_free($this->parser);\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\r
-               $this->parser = xml_parser_create();\r
-               xml_set_object($this->parser, $this);\r
-               xml_set_element_handler($this->parser, 'startElement', 'endElement');\r
-               xml_set_character_data_handler($this->parser, 'characterData');\r
-               xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0);\r
-\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
-       function readFile($filename, $metaOnly = 0) {\r
-               // open file\r
-               $this->fp = @fopen($filename, 'r');\r
-               if (!$this->fp) return 'Failed to open file/URL';\r
-\r
-               // here we go!\r
-               $this->inXml = 1;\r
-\r
-               while (!feof($this->fp)) {\r
-                       $tempbuffer .= fread($this->fp, 4096);\r
-               }\r
-               fclose($this->fp);\r
-\r
-/*\r
-       [2004-08-04] dekarma - Took this out since it messes up good XML if it has skins/templates\r
-                              with CDATA sections. need to investigate consequences.\r
-                              see bug [ 999914 ] Import fails (multiple skins in XML/one of them with CDATA)\r
-       \r
-               // backwards compatibility with the non-wellformed skinbackup.xml files\r
-               // generated by v2/v3 (when CDATA sections were present in skins)\r
-               // split up those CDATA sections into multiple ones\r
-               $tempbuffer = preg_replace_callback(\r
-                       "/(<!\[CDATA\[[^]]*?<!\[CDATA\[[^]]*)((?:\]\].*?<!\[CDATA.*?)*)(\]\])(.*\]\])/ms",\r
-                       create_function(\r
-                               '$matches',\r
-                               'return $matches[1] . preg_replace("/(\]\])(.*?<!\[CDATA)/ms","]]]]><![CDATA[$2",$matches[2])."]]]]><![CDATA[".$matches[4];'\r
-                       ),\r
-                       $tempbuffer\r
-               );              \r
-*/\r
-               $temp = tmpfile();\r
-               fwrite($temp, $tempbuffer);\r
-               rewind($temp);\r
-\r
-               while ( ($buffer = fread($temp, 4096) ) && (!$metaOnly || ($metaOnly && !$this->metaDataRead))) {\r
-                       $err = xml_parse( $this->parser, $buffer, feof($temp) );\r
-                       if (!$err && $this->debug)\r
-                               echo 'ERROR: ', xml_error_string(xml_get_error_code($this->parser)), '<br />';\r
-               }\r
-\r
-               // all done\r
-               $this->inXml = 0;\r
-               fclose($temp);\r
-       }       \r
-       \r
-       /**\r
-        * Returns the list of skin names\r
-        */\r
-       function getSkinNames() {\r
-               return array_keys($this->skins);\r
-       }\r
-\r
-       /**\r
-        * Returns the list of template names\r
-        */\r
-       function getTemplateNames() {\r
-               return array_keys($this->templates);\r
-       }       \r
-       \r
-       /**\r
-        * Returns the extra information included in the XML file\r
-        */\r
-       function getInfo() {\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
-       function writeToDatabase($allowOverwrite = 0) {\r
-               $existingSkins = $this->checkSkinNameClashes();\r
-               $existingTemplates = $this->checkTemplateNameClashes();\r
-               \r
-               // if not allowed to overwrite, check if any nameclashes exists\r
-               if (!$allowOverwrite) {\r
-                       if ((sizeof($existingSkins) > 0) || (sizeof($existingTemplates) > 0))\r
-                               return 'Name clashes detected, re-run with allowOverwrite = 1 to force overwrite';\r
-               }\r
-               \r
-               foreach ($this->skins as $skinName => $data) {\r
-                       // 1. if exists: delete all part data, update desc data\r
-                       //    if not exists: create desc\r
-                       if (in_array($skinName, $existingSkins)) {\r
-                               $skinObj = SKIN::createFromName($skinName);\r
-                               \r
-                               // delete all parts of the skin\r
-                               $skinObj->deleteAllParts();\r
-                               \r
-                               // update general info\r
-                               $skinObj->updateGeneralInfo($skinName, $data['description'], $data['type'], $data['includeMode'], $data['includePrefix']);\r
-                       } else {\r
-                               $skinid = SKIN::createNew($skinName, $data['description'], $data['type'], $data['includeMode'], $data['includePrefix']);\r
-                               $skinObj = new SKIN($skinid);\r
-                       }\r
-                       \r
-                       // 2. add parts\r
-                       foreach ($data['parts'] as $partName => $partContent) {\r
-                               $skinObj->update($partName, $partContent);\r
-                       }\r
-               }\r
-               \r
-               foreach ($this->templates as $templateName => $data) {\r
-                       // 1. if exists: delete all part data, update desc data\r
-                       //    if not exists: create desc\r
-                       if (in_array($templateName, $existingTemplates)) {\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
-                       } else {\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
-                               $templateObj->update($partName, $partContent);\r
-                       }                       \r
-               }\r
-       \r
-                       \r
-       }\r
-       \r
-       /**\r
-         * returns an array of all the skin nameclashes (empty array when no name clashes)\r
-         */\r
-       function checkSkinNameClashes() {\r
-               $clashes = array();\r
-               \r
-               foreach ($this->skins as $skinName => $data) {\r
-                       if (SKIN::exists($skinName))\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
-       function checkTemplateNameClashes() {\r
-               $clashes = array();\r
-               \r
-               foreach ($this->templates as $templateName => $data) {\r
-                       if (TEMPLATE::exists($templateName))\r
-                               array_push($clashes, $templateName);\r
-               }\r
-               \r
-               return $clashes;\r
-       }\r
-               \r
-       /**\r
-        * Called by XML parser for each new start element encountered\r
-        */\r
-       function startElement($parser, $name, $attrs) {\r
-               if ($this->debug) echo 'START: ', $name, '<br />';\r
-               \r
-               switch ($name) {\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
-                                       $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
-                               } else {\r
-                                       $this->skins[$attrs['name']] = array();                         \r
-                                       $this->skins[$attrs['name']]['parts'] = array();                                                                        \r
-                               }\r
-                               break;\r
-                       case 'template':\r
-                               if (!$this->inMeta) {\r
-                                       $this->inTemplate = 1;\r
-                                       $this->currentName = $attrs['name'];\r
-                                       $this->templates[$this->currentName]['parts'] = array();                                                                                                                        \r
-                               } else {\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 'UNEXPECTED TAG: ' , $name , '<br />';\r
-                               break;\r
-               }\r
-               \r
-               // character data never contains other tags\r
-               $this->clearCharacterData(); \r
-               \r
-       }\r
-\r
-       /**\r
-         * Called by the XML parser for each closing tag encountered\r
-         */\r
-       function endElement($parser, $name) {\r
-               if ($this->debug) echo 'END: ', $name, '<br />';\r
-               \r
-               switch ($name) {\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 = $this->getCharacterData();\r
-                       case 'skin':\r
-                               if (!$this->inMeta) $this->inSkin = 0;\r
-                               break;\r
-                       case 'template':\r
-                               if (!$this->inMeta) $this->inTemplate = 0;                      \r
-                               break;\r
-                       case 'description':\r
-                               if ($this->inSkin) {\r
-                                       $this->skins[$this->currentName]['description'] = $this->getCharacterData();\r
-                               } else {\r
-                                       $this->templates[$this->currentName]['description'] = $this->getCharacterData();                                \r
-                               }\r
-                               break;\r
-                       case 'part':\r
-                               if ($this->inSkin) {\r
-                                       $this->skins[$this->currentName]['parts'][$this->currentPartName] = $this->getCharacterData();\r
-                               } else {\r
-                                       $this->templates[$this->currentName]['parts'][$this->currentPartName] = $this->getCharacterData();                              \r
-                               }\r
-                               break;\r
-                       default:\r
-                               echo 'UNEXPECTED TAG: ' , $name, '<br />';\r
-                               break;\r
-               }\r
-               $this->clearCharacterData();\r
-\r
-       }\r
-       \r
-       /**\r
-        * Called by XML parser for data inside elements\r
-        */\r
-       function characterData ($parser, $data) {\r
-               if ($this->debug) echo 'NEW DATA: ', htmlspecialchars($data), '<br />';\r
-               $this->cdata .= $data;\r
-       }\r
-       \r
-       /**\r
-        * Returns the data collected so far\r
-        */\r
-       function getCharacterData() {\r
-               return $this->cdata;\r
-       }\r
-       \r
-       /**\r
-        * Clears the data buffer\r
-        */\r
-       function clearCharacterData() {\r
-               $this->cdata = '';\r
-       }\r
-       \r
-       /**\r
-        * Static method that looks for importable XML files in subdirs of the given dir\r
-        */\r
-       function searchForCandidates($dir) {\r
-               $candidates = array();\r
-\r
-               $dirhandle = opendir($dir);\r
-               while ($filename = readdir($dirhandle)) {\r
-                       if (@is_dir($dir . $filename) && ($filename != '.') && ($filename != '..')) {\r
-                               $xml_file = $dir . $filename . '/skinbackup.xml';\r
-                               if (file_exists($xml_file) && is_readable($xml_file)) {\r
-                                       $candidates[$filename] = $filename; //$xml_file;\r
-                               } \r
-\r
-                               // backwards compatibility                      \r
-                               $xml_file = $dir . $filename . '/skindata.xml';\r
-                               if (file_exists($xml_file) && is_readable($xml_file)) {\r
-                                       $candidates[$filename] = $filename; //$xml_file;\r
-                               } \r
-                       }\r
-               }\r
-               closedir($dirhandle);\r
-               \r
-               return $candidates;\r
-       \r
-       }\r
-        \r
-       \r
-}\r
-\r
-\r
-class SKINEXPORT {\r
-\r
-       var $templates;\r
-       var $skins;\r
-       var $info;\r
-       \r
-       /**\r
-        * Constructor initializes data structures\r
-        */\r
-       function SKINEXPORT() {\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
-       function addTemplate($id) {\r
-               if (!TEMPLATE::existsID($id)) return 0;\r
-       \r
-               $this->templates[$id] = TEMPLATE::getNameFromId($id);\r
-               \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
-       function addSkin($id) {\r
-               if (!SKIN::existsID($id)) return 0;\r
-               \r
-               $this->skins[$id] = SKIN::getNameFromId($id);\r
-               \r
-               return 1;\r
-       }\r
-       \r
-       /**\r
-        * Sets the extra info to be included in the exported file\r
-        */\r
-       function setInfo($info) {\r
-               $this->info = $info;\r
-       }\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
-       function export($setHeaders = 1) {\r
-               if ($setHeaders) {\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');\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
-                               echo "\t\t", '<skin name="',htmlspecialchars($skinName),'" />',"\n";\r
-                       }\r
-                       // templates\r
-                       foreach ($this->templates as $templateId => $templateName) {\r
-                               echo "\t\t", '<template name="',htmlspecialchars($templateName),'" />',"\n";\r
-                       }\r
-                       // extra info\r
-                       if ($this->info)\r
-                               echo "\t\t<info><![CDATA[",$this->info,"]]></info>\n";\r
-               echo "\t</meta>\n\n\n";\r
-               \r
-               // contents skins\r
-               foreach ($this->skins as $skinId => $skinName) {\r
-                       $skinId = intval($skinId);\r
-                       $skinObj = new SKIN($skinId);\r
-                       \r
-                       echo "\t", '<skin name="',htmlspecialchars($skinName),'" type="',htmlspecialchars($skinObj->getContentType()),'" includeMode="',htmlspecialchars($skinObj->getIncludeMode()),'" includePrefix="',htmlspecialchars($skinObj->getIncludePrefix()),'">',"\n";\r
-                       \r
-                       echo "\t\t", '<description>',htmlspecialchars($skinObj->getDescription()),'</description>',"\n";\r
-                       \r
-                       $res = sql_query('SELECT stype, scontent FROM '.sql_table('skin').' WHERE sdesc='.$skinId);\r
-                       while ($partObj = mysql_fetch_object($res)) {\r
-                               echo "\t\t",'<part name="',htmlspecialchars($partObj->stype),'">';\r
-                               echo '<![CDATA[', $this->escapeCDATA($partObj->scontent),']]>';\r
-                               echo "</part>\n\n";\r
-                       }\r
-                       \r
-                       echo "\t</skin>\n\n\n";\r
-               }\r
-               \r
-               // contents templates\r
-               foreach ($this->templates as $templateId => $templateName) {\r
-                       $templateId = intval($templateId);\r
-                       \r
-                       echo "\t",'<template name="',htmlspecialchars($templateName),'">',"\n";\r
-                       \r
-                       echo "\t\t",'<description>',htmlspecialchars(TEMPLATE::getDesc($templateId)),'</description>',"\n";                     \r
-                       \r
-                       $res = sql_query('SELECT tpartname, tcontent FROM '.sql_table('template').' WHERE tdesc='.$templateId);\r
-                       while ($partObj = mysql_fetch_object($res)) {\r
-                               echo "\t\t",'<part name="',htmlspecialchars($partObj->tpartname),'">';\r
-                               echo '<![CDATA[', $this->escapeCDATA($partObj->tcontent) ,']]>';\r
-                               echo '</part>',"\n\n";\r
-                       }\r
-                       \r
-                       echo "\t</template>\n\n\n";\r
-               }               \r
-               \r
-               echo '</nucleusskin>';\r
-       }\r
-       \r
-       /**\r
-        * Escapes CDATA content so it can be included in another CDATA section\r
-        */\r
-       function escapeCDATA($cdata)\r
-       {\r
-               return preg_replace('/]]>/', ']]]]><![CDATA[>', $cdata);\r
-               \r
-       }\r
-}\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)
+ */
+/**
+ *     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-2007 The Nucleus Group
+ * @version $Id: skinie.php,v 1.4 2007-03-22 09:23:58 kimitake Exp $
+ * @version $NucleusJP: skinie.php,v 1.8 2007/03/22 03:30:14 kmorimatsu Exp $
+ */
+
+class SKINIMPORT {
+
+       // hardcoded value (see constructor). When 1, interesting info about the
+       // parsing process is sent to the output
+       var $debug;
+
+       // parser/file pointer
+       var $parser;
+       var $fp;
+
+       // which data has been read?
+       var $metaDataRead;
+       var $allRead;
+
+       // extracted data
+       var $skins;
+       var $templates;
+       var $info;
+
+       // to maintain track of where we are inside the XML file
+       var $inXml;
+       var $inData;
+       var $inMeta;
+       var $inSkin;
+       var $inTemplate;
+       var $currentName;
+       var $currentPartName;
+       var $cdata;
+
+
+
+       /**
+        * constructor initializes data structures
+        */
+       function SKINIMPORT() {
+               // disable magic_quotes_runtime if it's turned on
+               set_magic_quotes_runtime(0);
+
+               // debugging mode?
+               $this->debug = 0;
+
+               $this->reset();
+
+       }
+
+       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 = xml_parser_create();
+               xml_set_object($this->parser, $this);
+               xml_set_element_handler($this->parser, 'startElement', 'endElement');
+               xml_set_character_data_handler($this->parser, 'characterData');
+               xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0);
+
+       }
+
+       /**
+        * 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)
+        */
+       function readFile($filename, $metaOnly = 0) {
+               // open file
+               $this->fp = @fopen($filename, 'r');
+               if (!$this->fp) return 'Failed to open file/URL';
+
+               // here we go!
+               $this->inXml = 1;
+
+               $tempbuffer = null;
+
+               while (!feof($this->fp)) {
+                       $tempbuffer .= fread($this->fp, 4096);
+               }
+               fclose($this->fp);
+
+/*
+       [2004-08-04] dekarma - Took this out since it messes up good XML if it has skins/templates
+                                                  with CDATA sections. need to investigate consequences.
+                                                  see bug [ 999914 ] Import fails (multiple skins in XML/one of them with CDATA)
+
+               // backwards compatibility with the non-wellformed skinbackup.xml files
+               // generated by v2/v3 (when CDATA sections were present in skins)
+               // split up those CDATA sections into multiple ones
+               $tempbuffer = preg_replace_callback(
+                       "/(<!\[CDATA\[[^]]*?<!\[CDATA\[[^]]*)((?:\]\].*?<!\[CDATA.*?)*)(\]\])(.*\]\])/ms",
+                       create_function(
+                               '$matches',
+                               'return $matches[1] . preg_replace("/(\]\])(.*?<!\[CDATA)/ms","]]]]><![CDATA[$2",$matches[2])."]]]]><![CDATA[".$matches[4];'
+                       ),
+                       $tempbuffer
+               );
+*/
+               $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);
+       }
+
+       /**
+        * Returns the list of skin names
+        */
+       function getSkinNames() {
+               return array_keys($this->skins);
+       }
+
+       /**
+        * Returns the list of template names
+        */
+       function getTemplateNames() {
+               return array_keys($this->templates);
+       }
+
+       /**
+        * Returns the extra information included in the XML file
+        */
+       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)
+        */
+       function writeToDatabase($allowOverwrite = 0) {
+               $existingSkins = $this->checkSkinNameClashes();
+               $existingTemplates = $this->checkTemplateNameClashes();
+
+               // if not allowed to overwrite, check if any nameclashes exists
+               if (!$allowOverwrite) {
+                       if ((sizeof($existingSkins) > 0) || (sizeof($existingTemplates) > 0))
+                               return 'Name clashes detected, re-run with allowOverwrite = 1 to force overwrite';
+               }
+
+               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 = new SKIN($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);
+                       }
+               }
+
+
+       }
+
+       /**
+         * returns an array of all the skin nameclashes (empty array when no name clashes)
+         */
+       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)
+         */
+       function checkTemplateNameClashes() {
+               $clashes = array();
+
+               foreach ($this->templates as $templateName => $data) {
+                       if (TEMPLATE::exists($templateName))
+                               array_push($clashes, $templateName);
+               }
+
+               return $clashes;
+       }
+
+       /**
+        * Called by XML parser for each new start element encountered
+        */
+       function startElement($parser, $name, $attrs) {
+               if ($this->debug) echo 'START: ', htmlspecialchars($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 'UNEXPECTED TAG: ' , htmlspecialchars($name) , '<br />';
+                               break;
+               }
+
+               // character data never contains other tags
+               $this->clearCharacterData();
+
+       }
+
+       /**
+         * Called by the XML parser for each closing tag encountered
+         */
+       function endElement($parser, $name) {
+               if ($this->debug) echo 'END: ', htmlspecialchars($name), '<br />';
+
+               switch ($name) {
+                       case 'nucleusskin':
+                               $this->inData = 0;
+                               $this->allRead = 1;
+                               break;
+                       case 'meta':
+                               $this->inMeta = 0;
+                               $this->metaDataRead = 1;
+                               break;
+                       case 'info':
+                               $this->info = $this->getCharacterData();
+                       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'] = $this->getCharacterData();
+                               } else {
+                                       $this->templates[$this->currentName]['description'] = $this->getCharacterData();
+                               }
+                               break;
+                       case 'part':
+                               if ($this->inSkin) {
+                                       $this->skins[$this->currentName]['parts'][$this->currentPartName] = $this->getCharacterData();
+                               } else {
+                                       $this->templates[$this->currentName]['parts'][$this->currentPartName] = $this->getCharacterData();
+                               }
+                               break;
+                       default:
+                               echo 'UNEXPECTED TAG: ' , htmlspecialchars($name), '<br />';
+                               break;
+               }
+               $this->clearCharacterData();
+
+       }
+
+       /**
+        * Called by XML parser for data inside elements
+        */
+       function characterData ($parser, $data) {
+               if ($this->debug) echo 'NEW DATA: ', htmlspecialchars($data), '<br />';
+               $this->cdata .= $data;
+       }
+
+       /**
+        * Returns the data collected so far
+        */
+       function getCharacterData() {
+               return $this->cdata;
+       }
+
+       /**
+        * Clears the data buffer
+        */
+       function clearCharacterData() {
+               $this->cdata = '';
+       }
+
+       /**
+        * Static method that looks for importable XML files in subdirs of the given dir
+        */
+       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)) {
+                                       $candidates[$filename] = $filename; //$xml_file;
+                               }
+
+                               // backwards compatibility
+                               $xml_file = $dir . $filename . '/skindata.xml';
+                               if (file_exists($xml_file) && is_readable($xml_file)) {
+                                       $candidates[$filename] = $filename; //$xml_file;
+                               }
+                       }
+               }
+               closedir($dirhandle);
+
+               return $candidates;
+
+       }
+
+
+}
+
+
+class SKINEXPORT {
+
+       var $templates;
+       var $skins;
+       var $info;
+
+       /**
+        * Constructor initializes data structures
+        */
+       function SKINEXPORT() {
+               // 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
+        */
+       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
+        */
+       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
+        */
+       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)
+        */
+       function export($setHeaders = 1) {
+               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');
+                       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="',htmlspecialchars($skinName),'" />',"\n";
+                       }
+                       // templates
+                       foreach ($this->templates as $templateId => $templateName) {
+                               echo "\t\t", '<template name="',htmlspecialchars($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 = intval($skinId);
+                       $skinObj = new SKIN($skinId);
+
+                       echo "\t", '<skin name="',htmlspecialchars($skinName),'" type="',htmlspecialchars($skinObj->getContentType()),'" includeMode="',htmlspecialchars($skinObj->getIncludeMode()),'" includePrefix="',htmlspecialchars($skinObj->getIncludePrefix()),'">',"\n";
+
+                       echo "\t\t", '<description>',htmlspecialchars($skinObj->getDescription()),'</description>',"\n";
+
+                       $res = sql_query('SELECT stype, scontent FROM '.sql_table('skin').' WHERE sdesc='.$skinId);
+                       while ($partObj = mysql_fetch_object($res)) {
+                               echo "\t\t",'<part name="',htmlspecialchars($partObj->stype),'">';
+                               echo '<![CDATA[', $this->escapeCDATA($partObj->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="',htmlspecialchars($templateName),'">',"\n";
+
+                       echo "\t\t",'<description>',htmlspecialchars(TEMPLATE::getDesc($templateId)),'</description>',"\n";
+
+                       $res = sql_query('SELECT tpartname, tcontent FROM '.sql_table('template').' WHERE tdesc='.$templateId);
+                       while ($partObj = mysql_fetch_object($res)) {
+                               echo "\t\t",'<part name="',htmlspecialchars($partObj->tpartname),'">';
+                               echo '<![CDATA[', $this->escapeCDATA($partObj->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
+        */
+       function escapeCDATA($cdata)
+       {
+               return preg_replace('/]]>/', ']]]]><![CDATA[>', $cdata);
+
+       }
+}
+
+?>
\ No newline at end of file
index 8169e55..c85bf88 100755 (executable)
@@ -1,19 +1,22 @@
 <?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)
+ */
 /**
-  * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/) 
-  * Copyright (C) 2002-2005 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)
-  *
-  * $Id: vars4.0.6.php,v 1.5 2006-12-18 20:31:39 kmorimatsu Exp $
-  * $NucleusJP: vars4.0.6.php,v 1.5 2005/03/12 06:19:05 kimitake Exp $
-  */
-  
+ * @license http://nucleuscms.org/license.txt GNU General Public License
+ * @copyright Copyright (C) 2002-2007 The Nucleus Group
+ * @version $Id: vars4.0.6.php,v 1.6 2007-03-22 09:23:58 kimitake Exp $
+ * @version $NucleusJP: vars4.0.6.php,v 1.10 2007/02/04 06:28:46 kimitake Exp $
+ */
+
 /**
   * The purpose of the functions below is to avoid declaring HTTP_ vars to be global
   * everywhere, plus to offer support for php versions before 4.1.0, that do not
   */
 function getVar($name) {
        global $HTTP_GET_VARS;
+
+       if (!isset($HTTP_GET_VARS[$name])) {
+               return;
+       }
+
        return undoMagic($HTTP_GET_VARS[$name]);
 }
 
 function postVar($name) {
        global $HTTP_POST_VARS;
+
+       if (!isset($HTTP_POST_VARS[$name])) {
+               return;
+       }
+
        return undoMagic($HTTP_POST_VARS[$name]);
 }
 
 function cookieVar($name) {
        global $HTTP_COOKIE_VARS;
+
+       if (!isset($HTTP_COOKIE_VARS[$name])) {
+               return;
+       }
+
        return undoMagic($HTTP_COOKIE_VARS[$name]);
 }
 
@@ -41,27 +59,55 @@ function requestVar($name) {
 
 function serverVar($name) {
        global $HTTP_SERVER_VARS;
+
+       if (!isset($HTTP_SERVER_VARS[$name])) {
+               return;
+       }
+
        return $HTTP_SERVER_VARS[$name];
 }
 
 // removes magic quotes if that option is enabled
 function undoMagic($data) {
-       return get_magic_quotes_gpc() ? stripslashes_array($data) : $data;
+       if (!get_magic_quotes_gpc())
+               return $data;
+       if (ini_get('magic_quotes_sybase') != 1)
+               return stripslashes_array($data);
+       else
+               return undoSybaseQuotes_array($data);
 }
 
 function stripslashes_array($data) {
        return is_array($data) ? array_map('stripslashes_array', $data) : stripslashes($data);
 }
 
+function undoSybaseQuotes_array($data) {
+       return is_array($data) ? array_map('undoSybaseQuotes', $data) : stripslashes($data);
+}
+
+function undoSybaseQuotes($data) {
+       return str_replace("''", "'", $data);
+}
+
 // integer array from request
 function requestIntArray($name) {
        global $HTTP_POST_VARS;
+
+       if (!isset($HTTP_POST_VARS[$name])) {
+               return;
+       }
+
        return $HTTP_POST_VARS[$name];
 }
 
 // array from request. Be sure to call undoMagic on the strings inside
 function requestArray($name) {
        global $HTTP_POST_VARS;
+
+       if (!isset($HTTP_POST_VARS[$name])) {
+               return;
+       }
+
        return $HTTP_POST_VARS[$name];
 }
 
@@ -92,6 +138,11 @@ function passRequestVars() {
 
 function postFileInfo($name) {
        global $HTTP_POST_FILES;
+
+       if (!isset($HTTP_POST_FILES[$name])) {
+               return;
+       }
+
        return $HTTP_POST_FILES[$name];
 }
 
@@ -100,4 +151,4 @@ function setOldAction($value) {
        $HTTP_POST_VARS['oldaction'] = $value;
 }
 
-?>
+?>
\ No newline at end of file
index 6ba8bcb..d670710 100755 (executable)
 <?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)
+ */
 /**
-  * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/) 
-  * Copyright (C) 2002-2005 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)
-  *
-  * $Id: vars4.1.0.php,v 1.5 2006-12-18 20:31:58 kmorimatsu Exp $
-  * $NucleusJP: vars4.1.0.php,v 1.5 2005/03/12 06:19:05 kimitake Exp $
-  */
-  
+ * @license http://nucleuscms.org/license.txt GNU General Public License
+ * @copyright Copyright (C) 2002-2007 The Nucleus Group
+ * @version $Id: vars4.1.0.php,v 1.6 2007-03-22 09:23:58 kimitake Exp $
+ * @version $NucleusJP: vars4.1.0.php,v 1.10 2007/02/04 06:28:46 kimitake Exp $
+ */
+
 function getVar($name) {
+       if (!isset($_GET[$name])) {
+               return;
+       }
+
        return undoMagic($_GET[$name]);
 }
 
 function postVar($name) {
+       if (!isset($_POST[$name])) {
+               return;
+       }
+
        return undoMagic($_POST[$name]);
 }
 
 function cookieVar($name) {
+       if (!isset($_COOKIE[$name])) {
+               return;
+       }
+
        return undoMagic($_COOKIE[$name]);
 }
 
 function requestVar($name) {
        if(array_key_exists($name,$_REQUEST))
                return undoMagic($_REQUEST[$name]);
-       elseif( array_key_exists($name,$_GET))   
+       elseif( array_key_exists($name,$_GET))
                return undoMagic($_GET[$name]);
-       elseif( array_key_exists($name,$_POST))   
+       elseif( array_key_exists($name,$_POST))
                return undoMagic($_POST[$name]);
        else
                return;
 }
 
 function serverVar($name) {
+       if (!isset($_SERVER[$name])) {
+               return false;
+       }
+
        return $_SERVER[$name];
 }
 
 // removes magic quotes if that option is enabled
 function undoMagic($data) {
-       return get_magic_quotes_gpc() ? stripslashes_array($data) : $data;
+       if (!get_magic_quotes_gpc())
+               return $data;
+       if (ini_get('magic_quotes_sybase') != 1)
+               return stripslashes_array($data);
+       else
+               return undoSybaseQuotes_array($data);
 }
 
 function stripslashes_array($data) {
        return is_array($data) ? array_map('stripslashes_array', $data) : stripslashes($data);
 }
 
+function undoSybaseQuotes_array($data) {
+       return is_array($data) ? array_map('undoSybaseQuotes', $data) : stripslashes($data);
+}
+
+function undoSybaseQuotes($data) {
+       return str_replace("''", "'", $data);
+}
+
 // integer array from request
 function requestIntArray($name) {
+       if (!isset($_REQUEST[$name])) {
+               return;
+       }
+
        return $_REQUEST[$name];
 }
 
 // array from request. Be sure to call undoMagic on the strings inside
 function requestArray($name) {
+       if (!isset($_REQUEST[$name])) {
+               return;
+       }
+
        return $_REQUEST[$name];
 }
 
@@ -77,6 +117,10 @@ function passRequestVars() {
 }
 
 function postFileInfo($name) {
+       if (!isset($_FILES[$name])) {
+               return;
+       }
+
        return $_FILES[$name];
 }
 
@@ -84,4 +128,5 @@ function setOldAction($value) {
        $_POST['oldaction'] = $value;
 }
 
-?>
+
+?>
\ No newline at end of file
index fb33046..67b2639 100755 (executable)
@@ -1,8 +1,9 @@
 <?php                                  // -*-c++-*-
 // by Edd Dumbill (C) 1999-2002
 // <edd@usefulinc.com>
-// $Id: xmlrpc.inc.php,v 1.6 2007-03-22 08:32:11 kimitake Exp $
-// $NucleusJP: xmlrpc.inc.php,v 1.5 2005/08/13 07:20:34 kimitake Exp $
+// $Id: xmlrpc.inc.php,v 1.7 2007-03-22 09:23:58 kimitake Exp $
+// $NucleusJP: xmlrpc.inc.php,v 1.6 2006/07/12 07:11:47 kimitake Exp $
+
 
 // Copyright (c) 1999,2000,2002 Edd Dumbill.
 // All rights reserved.
@@ -58,6 +59,7 @@
                global $xmlrpcI4;
                global $xmlrpcInt;
                global $xmlrpcDouble;
+               global $xmlrpcBoolean;
                global $xmlrpcString;
                global $xmlrpcDateTime;
                global $xmlrpcBase64;
                $xmlrpcStruct   => 3
        );
 
+       $xmlrpc_valid_parents = array(
+               'BOOLEAN' => array('VALUE' => 'VALUE'),
+               'I4' => array('VALUE' => 'VALUE'),
+               'INT' => array('VALUE' => 'VALUE'),
+               'STRING' => array('VALUE' => 'VALUE'),
+               'DOUBLE' => array('VALUE' => 'VALUE'),
+               'DATETIME.ISO8601' => array('VALUE' => 'VALUE'),
+               'BASE64' => array('VALUE' => 'VALUE'),
+               'ARRAY' => array('VALUE' => 'VALUE'),
+               'STRUCT' => array('VALUE' => 'VALUE'),
+               'PARAM' => array('PARAMS' => 'PARAMS'),
+               'METHODNAME' => array('METHODCALL' => 'METHODCALL'),
+               'PARAMS' => array('METHODCALL' => 'METHODCALL', 'METHODRESPONSE' => 'METHODRESPONSE'),
+               'MEMBER' => array('STRUCT' => 'STRUCT'),
+               'NAME' => array('MEMBER' => 'MEMBER'),
+               'DATA' => array('ARRAY' => 'ARRAY'),
+               'FAULT' => array('METHODRESPONSE' => 'METHODRESPONSE'),
+               'VALUE' => array('MEMBER' => 'MEMBER', 'DATA' => 'DATA', 'PARAM' => 'PARAM', 'FAULT' => 'FAULT')
+       );
+
        $xmlEntities=array(
                'amp'  => '&',
                'quot' => '"',
        $xmlrpcstr['no_ssl']='No SSL support compiled in.';
        $xmlrpcerr['curl_fail']=8;
        $xmlrpcstr['curl_fail']='CURL error';
-
+       $xmlrpcerr['invalid_request']=15;
+       $xmlrpcstr['invalid_request']='Invalid request payload';
 
        $xmlrpcerr['multicall_notstruct'] = 9;
        $xmlrpcstr['multicall_notstruct'] = 'system.multicall expected struct';
        $xmlrpc_internalencoding='ISO-8859-1';
 
        $xmlrpcName='XML-RPC for PHP';
-       $xmlrpcVersion='1.1.1';
+       $xmlrpcVersion='1.2.1';
 
        // let user errors start at 800
        $xmlrpcerruser=800;
 
        // used to store state during parsing
        // quick explanation of components:
-       //   st - used to build up a string for evaluation
        //   ac - used to accumulate values
-       //   qt - used to decide if quotes are needed for evaluation
-       //   cm - used to denote struct or array (comma needed)
        //   isf - used to indicate a fault
        //   lv - used to indicate "looking for a value": implements
        //        the logic to allow values with no types to be strings
        //   params - used to store parameters in method calls
        //   method - used to store method name
+       //   stack - array with genealogy of xml elements names:
+       //           used to validate nesting of xmlrpc elements
 
        $_xh=array();
 
 
        function xmlrpc_se($parser, $name, $attrs)
        {
-               global $_xh, $xmlrpcDateTime, $xmlrpcString;
+               global $_xh, $xmlrpcDateTime, $xmlrpcString, $xmlrpc_valid_parents;
+
+               // if invalid xmlrpc already detected, skip all processing
+               if ($_xh[$parser]['isf'] < 2)
+               {
+
+               // check for correct element nesting
+               // top level element can only be of 2 types
+               if ($_xh[$parser]['sp'] == 0)
+               {
+                       if ($name != 'METHODRESPONSE' && $name != 'METHODCALL')
+                       {
+                               $_xh[$parser]['isf'] = 2;
+                               $_xh[$parser]['isf_reason'] = 'missing top level xmlrpc element';
+                               return;
+                       }
+               }
+               else
+               {
+                       // not top level element: see if parent is OK
+                       $parent = $_xh[$parser]['stack'][$_xh[$parser]['sp']-1];
+                       if (!isset($xmlrpc_valid_parents[$name][$parent]))
+                       {
+                               $_xh[$parser]['isf'] = 2;
+                               $_xh[$parser]['isf_reason'] = "xmlrpc element $name cannot be child of $parent";
+                               return;
+                       }
+               }
 
                switch($name)
                {
                        case 'STRUCT':
                        case 'ARRAY':
-                               $_xh[$parser]['st'].='array(';
-                               $_xh[$parser]['cm']++;
+                               //$_xh[$parser]['st'].='array(';
+                               //$_xh[$parser]['cm']++;
                                // this last line turns quoting off
                                // this means if we get an empty array we'll
                                // simply get a bit of whitespace in the eval
-                               $_xh[$parser]['qt']=0;
+                               //$_xh[$parser]['qt']=0;
+
+                               // create an empty array to hold child values, and push it onto appropriate stack
+                               $cur_val = array();
+                               $cur_val['values'] = array();
+                               $cur_val['type'] = $name;
+                               $_xh[$parser]['valuestack'][$_xh[$parser]['vsp']] = $cur_val;
+                               $_xh[$parser]['vsp']++;
                                break;
+                       case 'METHODNAME':
                        case 'NAME':
-                               $_xh[$parser]['st'].='"';
+                               //$_xh[$parser]['st'].='"';
                                $_xh[$parser]['ac']='';
                                break;
                        case 'FAULT':
                                $_xh[$parser]['isf']=1;
                                break;
                        case 'PARAM':
-                               $_xh[$parser]['st']='';
+                               //$_xh[$parser]['st']='';
+                               // clear value, so we can check later if no value will passed for this param/member
+                               $_xh[$parser]['value']='';
                                break;
                        case 'VALUE':
-                               $_xh[$parser]['st'].='new xmlrpcval(';
-                               $_xh[$parser]['vt']=$xmlrpcString;
+                               //$_xh[$parser]['st'].='new xmlrpcval(';
+                               // look for a value: if this is still true by the
+                               // time we reach the end tag for value then the type is string
+                               // by implication
+                               $_xh[$parser]['vt']='value';
                                $_xh[$parser]['ac']='';
-                               $_xh[$parser]['qt']=0;
+                               //$_xh[$parser]['qt']=0;
                                $_xh[$parser]['lv']=1;
-                               // look for a value: if this is still 1 by the
-                               // time we reach the first data segment then the type is string
-                               // by implication and we need to add in a quote
                                break;
                        case 'I4':
                        case 'INT':
                        case 'DOUBLE':
                        case 'DATETIME.ISO8601':
                        case 'BASE64':
-                               $_xh[$parser]['ac']=''; // reset the accumulator
+                               if ($_xh[$parser]['vt']!='value')
+                               {
+                                       //two data elements inside a value: an error occurred!
+                                       $_xh[$parser]['isf'] = 2;
+                                       $_xh[$parser]['isf_reason'] = "$name element following a {$_xh[$parser]['vt']} element inside a single value";
+                                       return;
+                               }
+
+                               // reset the accumulator
+                               $_xh[$parser]['ac']='';
 
-                               if ($name=='DATETIME.ISO8601' || $name=='STRING')
+                               /*if ($name=='DATETIME.ISO8601' || $name=='STRING')
                                {
                                        $_xh[$parser]['qt']=1;
                                        if ($name=='DATETIME.ISO8601')
                                        // at the end of the element we must check
                                        // for data format errors.
                                        $_xh[$parser]['qt']=0;
-                               }
+                               }*/
                                break;
                        case 'MEMBER':
-                               $_xh[$parser]['ac']='';
+                               //$_xh[$parser]['ac']='';
+                               // avoid warnings later on if no NAME is found before VALUE inside
+                               // a struct member predefining member name as NULL
+                               $_xh[$parser]['valuestack'][$_xh[$parser]['vsp']-1]['name'] = '';
+                               // clear value, so we can check later if no value will passed for this param/member
+                               $_xh[$parser]['value']='';
+                               break;
+                       case 'DATA':
+                       case 'METHODCALL':
+                       case 'METHODRESPONSE':
+                       case 'PARAMS':
+                               // valid elements that add little to processing
                                break;
                        default:
+                               /// INVALID ELEMENT: RAISE ISF so that it is later recognized!!!
+                               $_xh[$parser]['isf'] = 2;
+                               $_xh[$parser]['isf_reason'] = "found not-xmlrpc xml element $name";
                                break;
                }
 
+               // Save current element name to stack, to validate nesting
+               $_xh[$parser]['stack'][$_xh[$parser]['sp']] = $name;
+               $_xh[$parser]['sp']++;
+
                if ($name!='VALUE')
                {
                        $_xh[$parser]['lv']=0;
                }
        }
+       }
 
        function xmlrpc_ee($parser, $name)
        {
-               global $_xh,$xmlrpcTypes,$xmlrpcString;
+               global $_xh,$xmlrpcTypes,$xmlrpcString,$xmlrpcDateTime;
 
+               if ($_xh[$parser]['isf'] < 2)
+               {
+
+               // push this element name from stack
+               // NB: if XML validates, correct opening/closing is guaranteed and
+               // we do not have to check for $name == $curr_elem.
+               // we also checked for proper nesting at start of elements...
+               $_xh[$parser]['sp']--;
+               $curr_elem = $_xh[$parser]['stack'][$_xh[$parser]['sp']];
+               unset($_xh[$parser]['stack'][$_xh[$parser]['sp']]); 
                switch($name)
                {
                        case 'STRUCT':
                        case 'ARRAY':
-                               if ($_xh[$parser]['cm'] && substr($_xh[$parser]['st'], -1) ==',')
-                               {
-                                       $_xh[$parser]['st']=substr($_xh[$parser]['st'],0,-1);
-                               }
-                               $_xh[$parser]['st'].=')';
+                               //if ($_xh[$parser]['cm'] && substr($_xh[$parser]['st'], -1) ==',')
+                               //{
+                               //      $_xh[$parser]['st']=substr($_xh[$parser]['st'],0,-1);
+                               //}
+                               //$_xh[$parser]['st'].=')';
+
+                               // fetch out of stack array of values, and promote it to current value
+                               $_xh[$parser]['vsp']--;
+                               $cur_val = $_xh[$parser]['valuestack'][$_xh[$parser]['vsp']];
+                               unset($_xh[$parser]['valuestack'][$_xh[$parser]['vsp']]);
+                               $_xh[$parser]['value'] = $cur_val['values'];
+
                                $_xh[$parser]['vt']=strtolower($name);
-                               $_xh[$parser]['cm']--;
+                               //$_xh[$parser]['cm']--;
                                break;
                        case 'NAME':
-                               $_xh[$parser]['st'].= $_xh[$parser]['ac'] . '" => ';
+                               //$_xh[$parser]['st'].= $_xh[$parser]['ac'] . '" => ';
+                               $_xh[$parser]['valuestack'][$_xh[$parser]['vsp']-1]['name'] = $_xh[$parser]['ac'];
                                break;
                        case 'BOOLEAN':
-                               // special case here: we translate boolean 1 or 0 into PHP
-                               // constants true or false
-                               // NB: this simple checks helps a lot sanitizing input, ie no
-                               // security problems around here
-                               if ($_xh[$parser]['ac']=='1')
-                               {
-                                       $_xh[$parser]['ac']='true';
-                               }
-                               else
-                               {
-                                       $_xh[$parser]['ac']='false';
-                               }
-                               $_xh[$parser]['vt']=strtolower($name);
-                               // Drop through intentionally.
                        case 'I4':
                        case 'INT':
                        case 'STRING':
                        case 'DOUBLE':
                        case 'DATETIME.ISO8601':
                        case 'BASE64':
-                               if ($_xh[$parser]['qt']==1)
+                               $_xh[$parser]['vt']=strtolower($name);
+                               //if ($_xh[$parser]['qt']==1)                   
+                               if ($name=='STRING')
                                {
                                        // we use double quotes rather than single so backslashification works OK
-                                       $_xh[$parser]['st'].='"'. $_xh[$parser]['ac'] . '"';
+                                       //$_xh[$parser]['st'].='"'. $_xh[$parser]['ac'] . '"';
+                                       $_xh[$parser]['value']=$_xh[$parser]['ac'];
                                }
-                               elseif ($_xh[$parser]['qt']==2)
+                               elseif ($name=='DATETIME.ISO8601')
                                {
-                                       $_xh[$parser]['st'].='base64_decode("'. $_xh[$parser]['ac'] . '")';
+                                       $_xh[$parser]['vt']=$xmlrpcDateTime;
+                                       $_xh[$parser]['value']=$_xh[$parser]['ac'];
+                               }
+                               elseif ($name=='BASE64')
+                               {
+                                       //$_xh[$parser]['st'].='base64_decode("'. $_xh[$parser]['ac'] . '")';
+
+                                       ///@todo check for failure of base64 decoding / catch warnings
+                                       $_xh[$parser]['value']=base64_decode($_xh[$parser]['ac']);
                                }
                                elseif ($name=='BOOLEAN')
                                {
-                                       $_xh[$parser]['st'].=$_xh[$parser]['ac'];
+                                       // special case here: we translate boolean 1 or 0 into PHP
+                                       // constants true or false
+                                       // NB: this simple checks helps a lot sanitizing input, ie no
+                                       // security problems around here
+
+                                       // [MOD] S. Verberkt (Legolas) (13/02/2006 21:16): Also accept 'true' and 'false'
+                                       if ($_xh[$parser]['ac']=='1' || strcasecmp($_xh[$parser]['ac'], 'true') == 0)
+                                       {
+                                               //$_xh[$parser]['ac']='true';   
+                                               $_xh[$parser]['value']=true;
+                                       }
+                                       else
+                                       {
+                                               //$_xh[$parser]['ac']='false';
+                                               // log if receiveing something strange, even though we set the value to false anyway
+                                               if ($_xh[$parser]['ac']!='0' && strcasecmp($_xh[$parser]['ac'], 'false') != 0)
+                                                       error_log('XML-RPC: invalid value received in BOOLEAN: '.$_xh[$parser]['ac']);
+                                               $_xh[$parser]['value']=false;
+                                       }
+                                       // [/MOD]
+
+                                       //$_xh[$parser]['st'].=$_xh[$parser]['ac'];
                                }
                                elseif ($name=='DOUBLE')
                                {
                                                // TODO: find a better way of throwing an error
                                                // than this!
                                                error_log('XML-RPC: non numeric value received in DOUBLE: '.$_xh[$parser]['ac']);
-                                               $_xh[$parser]['st'].="'ERROR_NON_NUMERIC_FOUND'";
+                                               //$_xh[$parser]['st'].="'ERROR_NON_NUMERIC_FOUND'";
+                                               $_xh[$parser]['value']='ERROR_NON_NUMERIC_FOUND';
                                        }
                                        else
                                        {
                                                // it's ok, add it on
-                                               $_xh[$parser]['st'].=(double)$_xh[$parser]['ac'];
+                                               //$_xh[$parser]['st'].=(double)$_xh[$parser]['ac'];
+                                               $_xh[$parser]['value']=(double)$_xh[$parser]['ac'];
                                        }
                                }
                                else
                                                // TODO: find a better way of throwing an error
                                                // than this!
                                                error_log('XML-RPC: non numeric value received in INT: '.$_xh[$parser]['ac']);
-                                               $_xh[$parser]['st'].="'ERROR_NON_NUMERIC_FOUND'";
+                                               //$_xh[$parser]['st'].="'ERROR_NON_NUMERIC_FOUND'";
+                                               $_xh[$parser]['value']='ERROR_NON_NUMERIC_FOUND';
                                        }
                                        else
                                        {
                                                // it's ok, add it on
-                                               $_xh[$parser]['st'].=(int)$_xh[$parser]['ac'];
+                                               //$_xh[$parser]['st'].=(int)$_xh[$parser]['ac'];
+                                               $_xh[$parser]['value']=(int)$_xh[$parser]['ac'];
                                        }
                                }
                                $_xh[$parser]['ac']='';
-                               $_xh[$parser]['qt']=0;
+                               //$_xh[$parser]['qt']=0;
                                $_xh[$parser]['lv']=3; // indicate we've found a value
                                break;
                        case 'VALUE':
-                               // deal with a string value
-                               if (strlen($_xh[$parser]['ac'])>0 &&
+                               // This if() detects if no scalar was inside <VALUE></VALUE>
+                               if ($_xh[$parser]['vt']=='value')
+                               {
+                                       $_xh[$parser]['value']=$_xh[$parser]['ac'];
+                                       $_xh[$parser]['vt']=$xmlrpcString;
+                               }
+                               /*if (strlen($_xh[$parser]['ac'])>0 &&
                                        $_xh[$parser]['vt']==$xmlrpcString)
                                {
                                        $_xh[$parser]['st'].='"'. $_xh[$parser]['ac'] . '"';
                                if ($_xh[$parser]['cm'])
                                {
                                        $_xh[$parser]['st'].=',';
+                               }*/
+
+                               // build the xmlrpc val out of the data received, and substitute it
+                               $temp = new xmlrpcval($_xh[$parser]['value'], $_xh[$parser]['vt']);
+                               // check if we are inside an array or struct:
+                               // if value just built is inside an array, let's move it into array on the stack
+                               if ($_xh[$parser]['vsp'] && $_xh[$parser]['valuestack'][$_xh[$parser]['vsp']-1]['type']=='ARRAY')
+                               {
+                                       $_xh[$parser]['valuestack'][$_xh[$parser]['vsp']-1]['values'][] = $temp;
+                               }
+                               else
+                               {
+                               $_xh[$parser]['value'] = $temp;
                                }
                                break;
                        case 'MEMBER':
                                $_xh[$parser]['ac']='';
-                               $_xh[$parser]['qt']=0;
+                               //$_xh[$parser]['qt']=0;
+                               // add to array in the stack the last element built
+                               // unless no VALUE was found
+                               if ($_xh[$parser]['value'])
+                               {
+                                       $_xh[$parser]['valuestack'][$_xh[$parser]['vsp']-1]['values'][$_xh[$parser]['valuestack'][$_xh[$parser]['vsp']-1]['name']] = $_xh[$parser]['value'];
+                               }
+                               else
+                                       error_log('XML-RPC: missing VALUE inside STRUCT in received xml');
                                break;
                        case 'DATA':
                                $_xh[$parser]['ac']='';
-                               $_xh[$parser]['qt']=0;
+                               //$_xh[$parser]['qt']=0;
                                break;
                        case 'PARAM':
-                               $_xh[$parser]['params'][]=$_xh[$parser]['st'];
+                               //$_xh[$parser]['params'][]=$_xh[$parser]['st'];
+                               if ($_xh[$parser]['value'])
+                                       $_xh[$parser]['params'][]=$_xh[$parser]['value'];
+                               else
+                                       error_log('XML-RPC: missing VALUE inside PARAM in received xml');
                                break;
                        case 'METHODNAME':
                                $_xh[$parser]['method']=ereg_replace("^[\n\r\t ]+", '', $_xh[$parser]['ac']);
                                break;
-                       // BOOLEAN HAS BEEN ENUMERATED ABOVE!
-                       /*case 'BOOLEAN':
-                               // special case here: we translate boolean 1 or 0 into PHP
-                               // constants true or false
-                               if ($_xh[$parser]['ac']=='1')
-                               {
-                                       $_xh[$parser]['ac']='true';
-                               }
-                               else
-                               {
-                                       $_xh[$parser]['ac']='false';
-                                       $_xh[$parser]['vt']=strtolower($name);
-                               }
-                               break;*/
+                       case 'PARAMS':
+                       case 'FAULT':
+                       case 'METHODCALL':
+                       case 'METHORESPONSE':
+                               break;
                        default:
+                               // End of INVALID ELEMENT!
+                               // shall we add an assert here for unreachable code???
                                break;
                }
                // if it's a valid type name, set the type
-               if (isset($xmlrpcTypes[strtolower($name)]))
+               /*if (isset($xmlrpcTypes[strtolower($name)]))
                {
                        $_xh[$parser]['vt']=strtolower($name);
+               }*/
+
                }
        }
 
                //if (ereg("^[\n\r \t]+$", $data)) return;
                // print "adding [${data}]\n";
 
+               // skip processing if xml fault already detected
+               if ($_xh[$parser]['isf'] < 2)
+               {
                if ($_xh[$parser]['lv']!=3)
                {
                        // "lookforvalue==3" means that we've found an entire value
                        {
                                // if we've found text and we're just in a <value> then
                                // turn quoting on, as this will be a string
-                               $_xh[$parser]['qt']=1;
+                                       //$_xh[$parser]['qt']=1;
                                // and say we've found a value
                                $_xh[$parser]['lv']=2;
                        }
                        {
                                $_xh[$parser]['ac'] = '';
                        }
-                       $_xh[$parser]['ac'].=str_replace('$', '\$', str_replace('"', '\"', str_replace(chr(92),$xmlrpc_backslash, $data)));
+                               //$_xh[$parser]['ac'].=str_replace('$', '\$', str_replace('"', '\"', str_replace(chr(92),$xmlrpc_backslash, $data)));
+                               $_xh[$parser]['ac'].=$data;
+                       }
                }
        }
 
        function xmlrpc_dh($parser, $data)
        {
                global $_xh, $xmlrpc_backslash;
+
+               // skip processing if xml fault already detected
+               if ($_xh[$parser]['isf'] < 2)
+               {
                if (substr($data, 0, 1) == '&' && substr($data, -1, 1) == ';')
                {
                        if ($_xh[$parser]['lv']==1)
                        {
-                               $_xh[$parser]['qt']=1;
+                                       //$_xh[$parser]['qt']=1;
                                $_xh[$parser]['lv']=2;
                        }
-                       $_xh[$parser]['ac'].=str_replace('$', '\$', str_replace('"', '\"', str_replace(chr(92),$xmlrpc_backslash, $data)));
+                               //$_xh[$parser]['ac'].=str_replace('$', '\$', str_replace('"', '\"', str_replace(chr(92),$xmlrpc_backslash, $data)));
+                               $_xh[$parser]['ac'].=$data;
+                       }
                }
        }
 
 
                function serialize()
                {
-                       global $xmlrpc_defencoding;
                        $result = "<methodResponse>\n";
                        if ($this->errno)
                        {
 </member>
 <member>
 <name>faultString</name>
-<value><string>' . mb_convert_encoding(xmlrpc_encode_entitites($this->errstr), $xmlrpc_defencoding, _CHARSET) . '</string></value>
+<value><string>' . xmlrpc_encode_entitites($this->errstr) . '</string></value>
 </member>
 </struct>
 </value>
                        $_xh=array();
                        $_xh[$parser]=array();
                        $_xh[$parser]['headers'] = array();
+                       $_xh[$parser]['stack'] = array();
+                       $_xh[$parser]['sp'] = 0;
+                       $_xh[$parser]['valuestack'] = array();
+                       $_xh[$parser]['vsp'] = 0;
 
                        // separate HTTP headers from data
                        if (ereg("^HTTP", $data))
                        if ($bd)
                                $data = substr($data, 0, $bd);
 
-                       $_xh[$parser]['st']='';
-                       $_xh[$parser]['cm']=0;
+                       //$_xh[$parser]['st']='';
+                       //$_xh[$parser]['cm']=0;
                        $_xh[$parser]['isf']=0;
+                       $_xh[$parser]['isf_reason']=0;
                        $_xh[$parser]['ac']='';
-                       $_xh[$parser]['qt']='';
+                       //$_xh[$parser]['qt']='';
 
                        xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, true);
                        // G. Giunta 2005/02/13: PHP internally uses ISO-8859-1, so we have to tell
                                return $r;
                        }
                        xml_parser_free($parser);
+
+                       if ($_xh[$parser]['isf'] > 1)
+                       {
                        if ($this->debug)
                        {
-                               print "<PRE>---EVALING---[" .
-                               strlen($_xh[$parser]['st']) . " chars]---\n" .
-                               htmlspecialchars($_xh[$parser]['st']) . ";\n---END---</PRE>";
+                                       ///@todo echo something for user?
+                               }
+
+                               $r = new xmlrpcresp(0, $xmlrpcerr['invalid_return'],
+                               $xmlrpcstr['invalid_return'] . ' ' . $_xh[$parser]['isf_reason']);
                        }
-                       if (strlen($_xh[$parser]['st'])==0)
+                       //else if (strlen($_xh[$parser]['st'])==0)
+                       else if (!is_object($_xh[$parser]['value']))
                        {
                                // then something odd has happened
                                // and it's time to generate a client side error
                        }
                        else
                        {
-                               $allOK=0;
-                               @eval('$v=' . $_xh[$parser]['st'] . '; $allOK=1;');
-                               if (!$allOK)
+
+                               if ($this->debug)
                                {
-                                       $r = new xmlrpcresp(0, $xmlrpcerr['invalid_return'], $xmlrpcstr['invalid_return']);
+                                       //print "<PRE>---EVALING---[" .
+                                       //strlen($_xh[$parser]['st']) . " chars]---\n" .
+                                       //htmlspecialchars($_xh[$parser]['st']) . ";\n---END---</PRE>";
+                                       print "<PRE>---PARSED---\n" ;
+                                       var_dump($_xh[$parser]['value']);
+                                       print "\n---END---</PRE>";
                                }
-                               else
+
+                               //$allOK=0;
+                               //@eval('$v=' . $_xh[$parser]['st'] . '; $allOK=1;');
+                               //if (!$allOK)
+                               //{
+                               //      $r = new xmlrpcresp(0, $xmlrpcerr['invalid_return'], $xmlrpcstr['invalid_return']);
+                               //}
+                               //else
+                               $v = $_xh[$parser]['value'];
                                if ($_xh[$parser]['isf'])
                                {
                                        $errno_v = $v->structmem('faultCode');
 
                function addScalar($val, $type='string')
                {
-                       global $xmlrpcTypes, $xmlrpcBoolean, $xmlrpc_defencoding;
+                       global $xmlrpcTypes, $xmlrpcBoolean;
 
                        if ($this->mytype==1)
                        {
                {
                        $rs='';
                        global $xmlrpcTypes, $xmlrpcBase64, $xmlrpcString,
-                       $xmlrpcBoolean, $xmlrpc_defencoding;
+                       $xmlrpcBoolean;
                        switch(@$xmlrpcTypes[$typ])
                        {
                                case 3:
                                                        // $rs.="<${typ}>" . htmlentities($val). "</${typ}>";
                                                        
                                                        // N. Leenheer 2005/6/30: Use CDATA instead... 
-                                                       $rs.="<${typ}><![CDATA[" . mb_convert_encoding($val, $xmlrpc_defencoding, _CHARSET). "]]></${typ}>";
+                                                       $rs.="<${typ}><![CDATA[" . $val. "]]></${typ}>";
                                                        break;
                                                default:
                                                        $rs.="<${typ}>${val}</${typ}>";
                                @reset($t);
                                while(list($id,$cont) = @each($t))
                                {
-                                       eval('$b->'.$id.' = $cont;');
+                                       //eval('$b->'.$id.' = $cont;');
+                                       @$b->$id = $cont;
                                }
                        }
                        // end contrib
index ac87676..7e09019 100755 (executable)
@@ -1,8 +1,8 @@
 <?php
 // by Edd Dumbill (C) 1999-2002
 // <edd@usefulinc.com>
-// $Id: xmlrpcs.inc.php,v 1.6 2007-03-22 08:32:11 kimitake Exp $
-// $NucleusJP: xmlrpcs.inc.php,v 1.5 2005/08/13 07:20:34 kimitake Exp $
+// $Id: xmlrpcs.inc.php,v 1.7 2007-03-22 09:23:58 kimitake Exp $
+// $NucleusJP: xmlrpcs.inc.php,v 1.9 2007/02/04 06:28:46 kimitake Exp $
 
 // Copyright (c) 1999,2000,2002 Edd Dumbill.
 // All rights reserved.
                        $parser = xml_parser_create($xmlrpc_defencoding);
 
                        $_xh[$parser]=array();
-                       $_xh[$parser]['st']='';
-                       $_xh[$parser]['cm']=0;
+                       //$_xh[$parser]['st']='';
+                       //$_xh[$parser]['cm']=0;
                        $_xh[$parser]['isf']=0;
+                       $_xh[$parser]['isf_reason']='';
                        $_xh[$parser]['params']=array();
+                       $_xh[$parser]['stack']=array();
+                       $_xh[$parser]['sp'] = 0;
+                       $_xh[$parser]['valuestack'] = array();
+                       $_xh[$parser]['vsp'] = 0;
                        $_xh[$parser]['method']='';
 
                        // decompose incoming XML into request structure
                        xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, true);
             // G. Giunta 2005/02/13: PHP internally uses ISO-8859-1, so we have to tell
             // the xml parser to give us back data in the expected charset
-            xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, $xmlrpc_internalencoding);
+            @xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, $xmlrpc_internalencoding);
 
                        xml_set_element_handler($parser, 'xmlrpc_se', 'xmlrpc_ee');
                        xml_set_character_data_handler($parser, 'xmlrpc_cd');
                                xml_parser_free($parser);
                        }
                        else
+                       if ($_xh[$parser]['isf'])
                        {
                                xml_parser_free($parser);
+                               $r=new xmlrpcresp(0,
+                                       $xmlrpcerr['invalid_request'],
+                                       $xmlrpcstr['invalid_request'] . ' ' . $_xh[$parser]['isf_reason']);
+                       }
+                       else
+                       {
+                               xml_parser_free($parser);
+
                                $m=new xmlrpcmsg($_xh[$parser]['method']);
                                // now add parameters in
                                $plist='';
-                               $allOK = 1;
+                               //$allOK = 1;
                                for($i=0; $i<sizeof($_xh[$parser]['params']); $i++)
                                {
                                        //print "<!-- " . $_xh[$parser]['params'][$i]. "-->\n";
                                        $plist.="$i - " .  $_xh[$parser]['params'][$i]. ";\n";
-                                       $allOK = 0;
-                                       @eval('$m->addParam(' . $_xh[$parser]['params'][$i]. '); $allOK=1;');
-                                       if (!$allOK)
-                                       {
-                                               break;
-                                       }
+                                       //$allOK = 0;
+                                       //@eval('$m->addParam(' . $_xh[$parser]['params'][$i]. '); $allOK=1;');
+                                       @$m->addParam($_xh[$parser]['params'][$i]);
+                                       //if (!$allOK)
+                                       //{
+                                       //      break;
+                                       //}
                                }
                                // uncomment this to really see what the server's getting!
                                // xmlrpc_debugmsg($plist);
-                               if (!$allOK)
-                               {
-                                       $r = new xmlrpcresp(0,
-                                               $xmlrpcerr['incorrect_params'],
-                                               $xmlrpcstr['incorrect_params'] . ": xml error in param " . $i);
-                               }
-                               else
-                               {
+                               //if (!$allOK)
+                               //{
+                               //      $r = new xmlrpcresp(0,
+                               //              $xmlrpcerr['incorrect_params'],
+                               //              $xmlrpcstr['incorrect_params'] . ": xml error in param " . $i);
+                               //}
+                               //else
+                               //{
                                        $r = $this->execute($m);
-                               }
+                               //}
                        }
                        return $r;
                }
index d6136a9..0a5ecf9 100644 (file)
-<?php\r
-\r
-/*                                       */\r
-/* NP_SkinFiles                          */\r
-/* ------------------------------------  */\r
-/* A simple skin files manager           */\r
-/*                                       */\r
-/* code by Jeff MacMichael               */\r
-/* http://wiki.gednet.com/               */\r
-/*                                       */\r
-\r
-/* Changes:\r
- * v0.91 ged - added ICO, PHPx files, fixed/added some icons\r
- *           - changed perms on file or folder creation or upload to 0755 from 0640\r
- *           - changed 'cancel' links for delete actions to $parent dir from http_referer\r
- *           - changed order of links next to files... moved 'del' over a bit.  ;)\r
- * v0.92 ged - changed order of links next to dirs\r
- *             $privateskins = FALSE by default\r
- * v1.0  ged - fixed security catch so it actually quits the script\r
- *             "columnated" the files & dirs display for easier viewing\r
- *             Made the edit cancel link more intuitive\r
- * v1.01 ged - fixed event_QuickMenu to properly skip for non-admins\r
- *             lined up columns for directories & added <tr> highlights\r
- */\r
-\r
-class NP_SkinFiles extends NucleusPlugin {\r
-\r
-       function getName()              { return 'SkinFiles'; }\r
-       function getAuthor()    { return 'Jeff MacMichael'; }\r
-       function getURL()               { return 'http://wiki.gednet.com/'; }\r
-       function getVersion()   { return '1.01'; }\r
-       function getDescription() { return 'A simple file manager for skins.';  }\r
-\r
-       function supportsFeature($what) {\r
-               switch($what)\r
-               { case 'SqlTablePrefix':\r
-                               return 1;\r
-                       default:\r
-                               return 0; }\r
-       }\r
-\r
-       function install() {\r
-       }\r
-       \r
-       function unInstall() {\r
-       }\r
-\r
-       function getEventList() {\r
-               return array('QuickMenu');\r
-       }\r
-       \r
-       function hasAdminArea() {\r
-               return 1;\r
-       }\r
-       \r
-       function event_QuickMenu(&$data) {\r
-               global $member, $nucleus, $blogid;\r
-               // only show to admins\r
-               if (preg_match("/MD$/", $nucleus['version'])) {\r
-                       $isblogadmin = $member->isBlogAdmin(-1);\r
-               } else {\r
-                       $isblogadmin = $member->isBlogAdmin($blogid);\r
-               }\r
-               if (!($member->isLoggedIn() && ($member->isAdmin() | $isblogadmin))) return;\r
-               array_push(\r
-                       $data['options'], \r
-                       array(\r
-                               'title' => 'Skin Files',\r
-                               'url' => $this->getAdminURL(),\r
-                               'tooltip' => 'Manage skin files'\r
-                       )\r
-               );\r
-       }\r
-}\r
-?>
\ No newline at end of file
+<?php
+
+class NP_SkinFiles extends NucleusPlugin {
+
+   /* ==========================================================================================
+       * Nucleus SkinFiles Plugin
+       *
+       * Copyright 2005-2007 by Jeff MacMichael and Niels Leenheer
+       *
+       * @version $Id: NP_SkinFiles.php,v 1.2 2007-03-22 09:24:07 kimitake Exp $
+       * @version $NucleusJP: NP_SkinFiles.php,v 1.4 2007/02/04 06:28:46 kimitake Exp $
+       *
+       * ==========================================================================================
+       * This program is free software and open source 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.
+       *
+       * This program is distributed in the hope that it will be useful, but WITHOUT
+       * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+       * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+       * more details.
+       *
+       * You should have received a copy of the GNU General Public License along
+       * with this program; if not, write to the Free Software Foundation, Inc.,
+       * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA  or visit
+       * http://www.gnu.org/licenses/gpl.html
+       * ==========================================================================================
+       *
+       * Changes:
+       * v0.91 ged   - added ICO, PHPx files, fixed/added some icons
+       *             - changed perms on file or folder creation or upload to 0755 from 0640
+       *             - changed 'cancel' links for delete actions to $parent dir from http_referer
+       *             - changed order of links next to files... moved 'del' over a bit.  ;)
+       * v0.92 ged   - changed order of links next to dirs
+       *               $privateskins = FALSE by default
+       * v1.0  ged   - fixed security catch so it actually quits the script
+       *               "columnated" the files & dirs display for easier viewing
+       *               Made the edit cancel link more intuitive
+       * v1.01 ged   - fixed event_QuickMenu to properly skip for non-admins
+       *               lined up columns for directories & added <tr> highlights
+       * v2.00 rakaz - Almost complete rewrite
+       * v2.01 yama  - modified form button for IE
+       * v2.02 kimitake - multilingual support, modified form button for IE
+       */
+
+
+       function getName()                { return 'SkinFiles'; }
+       function getAuthor()      { return 'Misc authors'; }
+       function getURL()                 { return 'http://www.nucleuscms.org/'; }
+       function getVersion()     { return '2.02'; }
+       function getDescription() { return 'A simple file manager for skins.';  }
+
+       function supportsFeature($what) {
+               switch($what)
+               { case 'SqlTablePrefix':
+                               return 1;
+                       default:
+                               return 0; }
+       }
+
+       function install() {
+       }
+       
+       function unInstall() {
+       }
+
+       function getEventList() {
+               return array('QuickMenu');
+       }
+       
+       function hasAdminArea() {
+               return 1;
+       }
+
+       function init()
+       {
+               // include language file for this plugin
+               $language = ereg_replace( '[\\|/]', '', getLanguageName());
+               if (file_exists($this->getDirectory().$language.'.php'))
+                       include_once($this->getDirectory().$language.'.php');
+               else
+                       include_once($this->getDirectory().'english.php');
+       }
+       
+       function event_QuickMenu(&$data) {
+               global $member;
+
+               // only show to admins
+               if (!($member->isLoggedIn() && $member->isAdmin())) return;
+
+               array_push(
+                       $data['options'], 
+                       array(
+                               'title' => _SKINFILES_TITLE,
+                               'url' => $this->getAdminURL(),
+                               'tooltip' => _SKINFILES_TOOLTIP
+                       )
+               );
+       }
+}
+
+?>
index a23e3ee..602f58f 100644 (file)
-<?php\r
-\r
-/*                                       */\r
-/* Admin page for NP_SkinFiles           */\r
-/* ------------------------------------  */\r
-/* A simple skin files manager           */\r
-/*                                       */\r
-/* code by Jeff MacMichael               */\r
-/* http://gednet.com/                    */\r
-/*                                       */\r
-/* version 1.01                          */\r
\r
-       $strRel = '../../../'; \r
-       include($strRel . 'config.php');\r
-       \r
-       include($DIR_LIBS . 'PLUGINADMIN.php');\r
-\r
-       if (preg_match("/MD$/", $nucleus['version'])) {\r
-               $isblogadmin = $member->isBlogAdmin(-1);\r
-       } else {\r
-               $isblogadmin = $member->isBlogAdmin($blogid);\r
-       }\r
-       if (!($member->isAdmin() || $isblogadmin)) {\r
-               $oPluginAdmin = new PluginAdmin('SkinFiles');\r
-               $oPluginAdmin->start();\r
-               echo "<p>"._ERROR_DISALLOWED."</p>";\r
-               $oPluginAdmin->end();\r
-               exit;\r
-       }\r
-\r
-       // set to FALSE for normal operation, or TRUE if skins are stored\r
-       // under owner's member id i.e. /skins/1/grey/...   (MDNucleus)\r
-       $privateskins = FALSE;\r
-       if ($privateskins) { \r
-               global $member;\r
-               $SKINSUBDIR = $member->getID().'/'; \r
-               $latestskins = 'latest-skins/';\r
-       } else {\r
-               $SKINSUBDIR = '';\r
-       }\r
-       \r
-       global $pluginsskinfiles, $CONF;\r
-       $pluginsskinfiles=$CONF['PluginURL']."skinfiles";\r
-\r
-       if (isset($_GET['action'])) {$action = $_GET['action'];}\r
-       if (isset($_POST['action'])) {$action = $_POST['action'];}\r
-\r
-       if ($action == 'download') { \r
-               download();\r
-               return;\r
-               break;\r
-       }\r
-\r
-       // create the admin area page\r
-       $oPluginAdmin = new PluginAdmin('SkinFiles');\r
-       $oPluginAdmin->start();\r
-       \r
-       echo "<h2>Skin File Management</h2>";\r
-       \r
-       if (strstr('renfile delfile createdir rendir deldir deleteAllInDir'\r
-               .' editfile uploadfile createfile getLatestSkins', $action)) { \r
-               call_user_func($action);\r
-       } else {\r
-               showdir();\r
-       }\r
-\r
-       $oPluginAdmin->end();\r
-       return;\r
-       break;\r
-               \r
-       function createfile() {\r
-               global $oPluginAdmin, $DIR_SKINS, $SKINSUBDIR, $pluginsskinfiles;\r
-               $parent = $_POST["dir"];\r
-               $filename = $_POST["filename"];\r
-               $fullpath = $DIR_SKINS.$SKINSUBDIR.$parent.'/'.$filename;\r
-               if (file_exists($fullpath)) {\r
-                       $msg = "Error: the file '$filename' already exists.";\r
-                       showdir($msg);\r
-               }\r
-               echo "<h3><b>Creating file \"/$parent/$filename\":</b></h3>";\r
-               $errrep = error_reporting(E_ERROR);\r
-               if (touch($fullpath)) { \r
-                       $msg = 'The file was created successfully.';\r
-               } else {\r
-                       $msg = 'ERROR: The file was <i>not</i> created successfully.';\r
-               }\r
-               $oldumask = umask(0000);\r
-               chmod($fullpath, 0755);\r
-               umask($oldumask);\r
-               error_reporting($errrep);\r
-               showdir($msg);\r
-       }\r
-\r
-       function createdir() {\r
-               global $oPluginAdmin, $DIR_SKINS, $SKINSUBDIR, $pluginsskinfiles;\r
-               $parent = $_POST["dir"];\r
-               $newdir = $_POST["newdir"];\r
-               if (!$newdir) {\r
-                       echo 'You need to specify a directory name to create. <br /><br />';\r
-                       echo '> <a href="'.$_SERVER['HTTP_REFERER'].'">Go back</a><br />';              \r
-                       return;\r
-               }\r
-               $errrep = error_reporting(E_ERROR);\r
-               $oldumask = umask(0000);\r
-               if (mkdir ($DIR_SKINS.$SKINSUBDIR.$parent.'/'.$newdir, 0755)) {\r
-                       $msg = 'Directory created successfully.';\r
-               } else {\r
-                       $msg = 'There was an error creating the directory (check to see if the directory already exists).';\r
-               }\r
-               umask($oldumask);\r
-               error_reporting($errrep);\r
-               showdir($msg);\r
-       }\r
-       \r
-       function download() {\r
-               global $DIR_SKINS, $SKINSUBDIR;\r
-               $file = $_GET["rfp"];\r
-               $path = $DIR_SKINS.$SKINSUBDIR.$file;\r
-               $splitpath =  preg_split( "/\//", strrev($_GET["rfp"]), 2);\r
-               $file = strrev($splitpath[0]);\r
-               \r
-               // download code taken from Paul Alger's PHP_Easy_Download. \r
-\r
-               // translate file name properly for Internet Explorer.\r
-               if (strstr($_SERVER['HTTP_USER_AGENT'], "MSIE")){\r
-                       $file = preg_replace('/\./', '%2e', $file, substr_count($file, '.') - 1);\r
-               }\r
-               // make sure the file exists before sending headers\r
-               if(!$fdl=@fopen($path,'r')){\r
-                       die("Cannot Open File!");\r
-               } else {\r
-                       header("Cache-Control: ");// leave blank to avoid IE errors\r
-                       header("Pragma: ");// leave blank to avoid IE errors\r
-                       header("Content-type: application/octet-stream");\r
-                       header('Content-Disposition: attachment; filename="'.$file.'"');\r
-                       header("Content-length: ".(string)(filesize($path)));\r
-                       sleep(1);\r
-                       \r
-                       fpassthru($fdl);\r
-               }\r
-               return;\r
-               break;\r
-       }\r
-       \r
-       function uploadfile() {\r
-               global $HTTP_POST_FILES, $DIR_SKINS, $SKINSUBDIR, $pluginsskinfiles, $CONF;\r
-               $filename = $HTTP_POST_FILES['filename']['name'];\r
-               $filesize = $HTTP_POST_FILES['filename']['size'];\r
-               $filetempname = $HTTP_POST_FILES['filename']['tmp_name'];\r
-               $todir = $DIR_SKINS.$SKINSUBDIR.$_POST['dir'].'/';\r
-               \r
-               if ($filesize > $CONF['MaxUploadSize']) {\r
-                       showdir(_ERROR_FILE_TOO_BIG);\r
-                       return;\r
-               }\r
-\r
-               // check file type against allowed types\r
-               $ok = 0;\r
-               $allowedtypes = explode (',', "css,html,htm,xml,inc,txt,".$CONF['AllowedTypes']);\r
-               foreach ( $allowedtypes as $type ) \r
-                       if (eregi("\." .$type. "$",$filename)) $ok = 1;    \r
-               if (!$ok) {\r
-                       showdir(_ERROR_BADFILETYPE);\r
-                       return;\r
-               }\r
-               if (!is_uploaded_file($filetempname)) {\r
-                       showdir(_ERROR_BADREQUEST);\r
-                       return;\r
-               }\r
-               if (file_exists($todir.$filename)) {\r
-                       showdir(_ERROR_UPLOADDUPLICATE);\r
-                       return;\r
-               }\r
-\r
-               // move file to directory\r
-               if (is_uploaded_file($filetempname)) {\r
-                       $errrep = error_reporting(E_ERROR);\r
-                       if (!@move_uploaded_file($filetempname, $todir . $filename)) {\r
-                               showdir(_ERROR_UPLOADMOVE);\r
-                               return;\r
-                       }\r
-                       error_reporting($errrep);\r
-               }\r
-               // chmod uploaded file\r
-               $oldumask = umask(0000);\r
-               @chmod($todir . $filename, 0755); \r
-               umask($oldumask);               \r
-\r
-               showdir("File uploaded successfully.");\r
-       }\r
-\r
-       function rendir() {\r
-               global $DIR_SKINS, $SKINSUBDIR, $pluginsskinfiles;\r
-               if (isset($_POST['newname'])) {\r
-                       $splitpath =  preg_split( "/\//", strrev($_POST["oldname"]), 2);\r
-                       $newname = strrev($splitpath[1]) .'/'. $_POST["newname"];\r
-                       $newname = preg_replace("/^\//", "", $newname);\r
-                       $res = rename ( $DIR_SKINS.$SKINSUBDIR.$_POST["oldname"], \r
-                               $DIR_SKINS.$SKINSUBDIR.$newname);\r
-                       if ($res) { \r
-                               $msg = "Directory successfully renamed."; \r
-                       } else {\r
-                               $msg = "Failed to rename directory - (check to see if another directory already exists with the new name).";\r
-                       }\r
-                       showdir($msg);\r
-               } else { \r
-                       $oldname = preg_replace("/^\//", "", $_GET["oldname"]);\r
-                       echo '<h3><b>Rename directory "/'.$oldname.'":</b></h3>';\r
-                       $splitpath =  preg_split( "/\//", strrev($_GET["oldname"]), 2);\r
-                       $dir = strrev($splitpath[0]);\r
-                       $parent = strrev($splitpath[1]);\r
-                       echo '> <a href="'.$_SERVER['HTTP_REFERER'].'">Cancel rename</a><br />';                \r
-                       ?>\r
-                               <form method="post" action="<?php echo $pluginsskinfiles?>/">\r
-                                       <input type="hidden" name="action" value="rendir" />\r
-                                       <input type="hidden" name="dir" value="<?php echo "/$parent" ?>"/>\r
-                                       <input type="hidden" name="oldname" value="<?php echo $oldname?>"/>\r
-                                       <table><tr>\r
-                                               <td><?php echo 'Rename to'?></td>\r
-                                               <td><input name="newname" tabindex="90" value="<?php echo  htmlspecialchars($dir) ?>" maxlength="50" size="20" /></td>\r
-                                       </tr><tr>\r
-                                               <td><?php echo "Rename"?></td>\r
-                                               <td><input type="submit" tabindex="140" value="<?php echo "Rename this folder"?>" onclick="return checkSubmit();" /></td>\r
-                                       </tr></table>\r
-                               </form>\r
-                       <?PHP\r
-               }\r
-       }\r
-\r
-       function editfile () {\r
-               global $DIR_SKINS, $SKINSUBDIR, $pluginsskinfiles;\r
-               if (isset ($_POST['rfp']) && isset($_POST['content'])) {\r
-                       $file = $_POST['rfp'];\r
-                       $errrep = error_reporting(E_ERROR);\r
-                       $success = true;\r
-                       if ($fh = @fopen($DIR_SKINS.$SKINSUBDIR.$file, 'w')) { \r
-                               if (fwrite ($fh, trim(stripslashes($_POST['content'])))) {\r
-                                       fclose($fh);\r
-                               } else {\r
-                                       $success = false;\r
-                               }\r
-                       } else {\r
-                               $success = false;\r
-                       }\r
-                       error_reporting($errrep);\r
-                       if ($success) {\r
-                               $msg = 'File was edited successfully.';\r
-                       } else {\r
-                               $msg = 'ERROR: File was <i>not</i> saved successfully.';\r
-                       }\r
-               }\r
-               if (isset ($_GET['rfp'])) { $file = $_GET['rfp']; }\r
-               if (isset ($_POST['rfp'])) { $file = $_POST['rfp']; }\r
-               $splitpath =  preg_split( "/\//", strrev($file), 2);\r
-               $parent = strrev($splitpath[1]);\r
-               echo '<h3>Editing file "/'.$file.'":</h3>';\r
-               if (isset($msg)) { echo "<p><b>$msg</b></p>"; }\r
-               echo "> <a href=\"$pluginsskinfiles/?dir=$parent\"> Cancel/Return to /$parent</a><br /><br />";\r
-               $fh = @fopen($DIR_SKINS.$SKINSUBDIR.$file, 'r');\r
-               while (!feof($fh)) { \r
-                       $content .= fread($fh, 4096); \r
-               }\r
-               fclose ($fh);                   \r
-               ?>\r
-                       <form method="post" action="<?php echo $pluginsskinfiles?>/">\r
-                               <input type="hidden" name="action" value="editfile" />\r
-                               <input type="hidden" name="rfp" value="<?php echo $file ?>"/>\r
-                               <input type="hidden" name="dir" value="<?php echo $parent ?>"/>\r
-                               <input type="submit" tabindex="140" value="<?php echo "Save changes"?>" onclick="return checkSubmit();" />\r
-                               <input type="reset" value="Reset Data" /><br />\r
-                               <textarea class="skinedit" tabindex="8" rows="20" cols="80" name="content"><?PHP echo htmlspecialchars($content) ?></textarea>\r
-                               <input type="submit" tabindex="140" value="<?php echo "Save changes"?>" onclick="return checkSubmit();" />\r
-                               <input type="reset" value="Reset Data" /><br />\r
-                       </form>\r
-               <?PHP\r
-       }\r
-\r
-\r
-       function renfile() {\r
-               global $DIR_SKINS, $SKINSUBDIR, $pluginsskinfiles;\r
-               if (isset($_POST['newname'])) {\r
-                       $splitpath =  preg_split( "/\//", strrev($_POST["oldname"]), 2);\r
-                       $newname = strrev($splitpath[1]) .'/'. $_POST["newname"];\r
-                       $newname = preg_replace("/^\//", "", $newname);\r
-                       $res = rename ( $DIR_SKINS.$SKINSUBDIR.$_POST["oldname"], \r
-                               $DIR_SKINS.$SKINSUBDIR.$newname);\r
-                       if ($res) { \r
-                               $msg = "File successfully renamed."; \r
-                       } else {\r
-                               $msg = "File could not be renamed - (check to see if another file already exists with the new name).";\r
-                       }\r
-                       showdir($msg);\r
-               } else { \r
-                       echo '<h3><b>Rename file "/'.$_GET["rfp"].'":</b></h3>';\r
-                       $splitpath =  preg_split( "/\//", strrev($_GET["rfp"]), 2);\r
-                       $file = strrev($splitpath[0]);\r
-                       $parent = strrev($splitpath[1]);\r
-                       echo '> <a href="'.$_SERVER['HTTP_REFERER'].'">Cancel rename</a><br />';                \r
-                       ?>\r
-                               <form method="post" action="<?php echo $pluginsskinfiles?>/">\r
-                                       <input type="hidden" name="action" value="renfile" />\r
-                                       <input type="hidden" name="oldname" value="<?php echo $_GET["rfp"] ?>"/>\r
-                                       <input type="hidden" name="dir" value="<?php echo "/$parent" ?>"/>\r
-                                       <table><tr>\r
-                                               <td><?php echo 'Rename to'?></td>\r
-                                               <td><input name="newname" tabindex="90" value="<?php echo  htmlspecialchars($file) ?>" maxlength="50" size="20" /></td>\r
-                                       </tr><tr>\r
-                                               <td><?php echo "Rename"?></td>\r
-                                               <td><input type="submit" tabindex="140" value="<?php echo "Rename this file"?>" onclick="return checkSubmit();" /></td>\r
-                                       </tr></table>\r
-                               </form>\r
-                       <?PHP\r
-               }\r
-       }\r
-\r
-       function delfile() {\r
-               global $DIR_SKINS, $SKINSUBDIR, $pluginsskinfiles;\r
-               if (isset($_GET['sure'])) { \r
-                       $file = $DIR_SKINS.$SKINSUBDIR.$_GET["rfp"];\r
-                       $errrep = error_reporting(E_ERROR);\r
-                       if (unlink ($file)) {\r
-                               $msg = 'File "'.$_GET["rfp"].'" has been deleted.';\r
-                       } else {\r
-                               $msg = 'ERROR: File "'.$_GET["rfp"].'" could not be deleted.';\r
-                       }\r
-                       error_reporting($errrep);\r
-                       showdir($msg);\r
-               } else {\r
-                       $file = $DIR_SKINS.$SKINSUBDIR.$_GET["rfp"];\r
-                       $splitpath =  preg_split( "/\//", strrev($_GET["rfp"]), 2);\r
-                       $parent = strrev($splitpath[1]);\r
-                       echo '<h3><b>Delete file "'.$_GET["rfp"].'": are you sure?</b></h3>';\r
-                       echo '<b>This action cannot be undone!</b><br /><br />';\r
-                       echo "> <a href=\"$pluginsskinfiles/?action=delfile&dir=$parent&sure=y&rfp=".$_GET["rfp"]."\">Yes, delete the file.</a><br />";         \r
-                       echo "> <a href=\"$pluginsskinfiles/?dir=".$parent.'">No, go back.</a><br />';          \r
-               }\r
-       }\r
-\r
-       function deldir() {\r
-               global $DIR_SKINS, $SKINSUBDIR, $pluginsskinfiles;\r
-               if (isset($_GET['sure'])) { \r
-                       $dir = $DIR_SKINS.$SKINSUBDIR.$_GET["remdir"];\r
-                       $errrep = error_reporting(E_ERROR);\r
-                       if (rmdir ($dir)) {\r
-                               $msg = 'Directory "'.$_GET["remdir"].'" has been deleted.';\r
-                       } else {\r
-                               $msg = 'ERROR: directory "'.$_GET["remdir"].'" could not be deleted - (check to see if it contains files).';\r
-                       }\r
-                       error_reporting($errrep);\r
-                       showdir($msg);\r
-               } else {\r
-                       $dir = preg_replace("/^\//", "",$_GET['remdir']);\r
-                       $parent = $_GET['dir'];\r
-                       echo '<h3><b>Delete directory "/'.$dir.'": are you sure?</b></h3>';\r
-                       echo '<b>This action cannot be undone!</b><br /><br />';\r
-                       echo "> <a href=\"$pluginsskinfiles/?action=deldir&sure=y&remdir=$dir&dir=$parent\">Yes, delete the directory (it must be empty to do this).</a><br /><br />";          \r
-                       echo "> <a href=\"$pluginsskinfiles/?dir=".$parent.'">No, go back.</a><br />';          \r
-               }\r
-       }\r
-\r
-       function deleteAllInDir() {\r
-               global $DIR_SKINS, $SKINSUBDIR, $pluginsskinfiles;\r
-               $parent = $DIR_SKINS.$SKINSUBDIR.preg_replace("/^\//", "",$_GET['dir']);\r
-               if ($dh = @opendir($parent)) { \r
-                       while (($file = readdir($dh)) !== false) { \r
-                               if(!preg_match("/^\.{1,2}/", $file)){\r
-                                       if (!is_dir($parent.$file)) {\r
-                                               $files[] = $file;\r
-                                       }\r
-                               }\r
-                       }\r
-                       closedir($dh); \r
-               } \r
-               if (isset($_GET['sure'])) { \r
-                       $errrep = error_reporting(E_ERROR);\r
-                       echo '<h3>Deletion results</h3><table>';\r
-                       echo "> <a href=\"$pluginsskinfiles/?dir=".$_GET["dir"]."\">Return to the /".$_GET["dir"]." directory.</a><br />";              \r
-                       foreach ($files as $file) {\r
-                               if (unlink ("$parent/$file")) { \r
-                                       echo "<tr><td>File: $file was deleted.</td></tr>"; \r
-                               } else {\r
-                                       echo "<tr><td>File: $file was <b>NOT</b> deleted.</td></tr>";\r
-                               }\r
-                       }\r
-                       echo "</table>";\r
-                       error_reporting($errrep);\r
-                       echo "> <a href=\"$pluginsskinfiles/?dir=".$_GET["dir"]."\">Return to the /".$_GET["dir"]." directory.</a><br />";              \r
-               } else {\r
-                       echo '<h3><b>Delete all files in directory "/'.$_GET['dir'].'": are you sure?</b></h3>';\r
-                       echo '<b>This action cannot be undone!</b><br /><br />';\r
-                       echo "> <a href=\"$pluginsskinfiles/?action=deleteAllInDir&sure=y&dir=".$_GET["dir"]."\">Yes, delete <u>all files</u> in this directory.</a><br />";            \r
-                       echo "> <a href=\"$pluginsskinfiles/?dir=".$_GET['dir'].'">No, go back.</a><br /><br />';               \r
-                       echo '<b>Files list:</b><table>';\r
-                       foreach ($files as $file) {     echo "<tr><td>$file</td></tr>"; }\r
-                       echo '</table>';\r
-               }\r
-       }\r
-\r
-       // function for MDNucleus; won't work unless $privateskins is set to true\r
-       function getLatestSkins() {\r
-               global $DIR_SKINS, $pluginsskinfiles, $privateskins, $latestskins, $member;\r
-               $confirmed = $_POST['overwrite'];\r
-               if (!$confirmed) {\r
-                       showdir("Overwrite of default skin files not confirmed - no action taken.");\r
-                       return;\r
-               }\r
-               if ($dh = @opendir($DIR_SKINS.$latestskins)) { \r
-                       while (($file = readdir($dh)) !== false) { \r
-                               if(!preg_match("/^\.{1,2}/", $file))\r
-                                       if (is_dir($DIR_SKINS.$latestskins.$file)) $skins[] = $file;\r
-                       }\r
-                       closedir($dh); \r
-               } \r
-               if ($skins) {\r
-                       $msg = "Refreshed skin folders:";\r
-                       sort ($skins);\r
-                       foreach ($skins as $skin) {\r
-                               $memberskin = $DIR_SKINS.$member->getID().'/'.$skin;\r
-                               if (is_file($memberskin)) unlink($memberskin);\r
-                               if (!is_dir($memberskin)) {\r
-                                       $old_umask = umask(0);\r
-                                       mkdir($memberskin, 0755);\r
-                                       umask($old_umask);\r
-                               }\r
-                               exec("rsync -Wtr --delete ".$DIR_SKINS.$latestskins.$skin."/* ".$memberskin.'/');\r
-                               $msg .= "  $skin";\r
-                       }\r
-               } else {\r
-                       showdir("No default skin folders found.  No action taken.");\r
-                       return;\r
-               }\r
-               showdir($msg);\r
-       }\r
-\r
-       function _isImageFile($file) {\r
-               return preg_match ("/\.(gif|png|jpg|jpeg|bmp|ico)$/i", $file);\r
-       }\r
-\r
-       function _isEditableFile($file) {\r
-               return preg_match ("/\.(inc|txt|htm|html|xml)$/i", $file);\r
-       }\r
-\r
-       function showdir($msg = '') {\r
-               global $DIR_SKINS, $SKINSUBDIR, $pluginsskinfiles, $CONF;\r
-               global $privateskins, $latestskins;\r
-               if (isset($_GET['dir'])) { \r
-                       $newdir = preg_replace("/^\//", "",$_GET['dir']);\r
-                       $currdir = $DIR_SKINS.$SKINSUBDIR."$newdir/";\r
-                       $in_subdir = 1;\r
-               } elseif (isset($_POST['dir'])) { \r
-                       $newdir = preg_replace("/^\//", "",$_POST['dir']);\r
-                       $currdir = $DIR_SKINS.$SKINSUBDIR."$newdir/";\r
-                       $in_subdir = 1;\r
-               } else {\r
-                       $newdir = '';\r
-                       $currdir = $DIR_SKINS.$SKINSUBDIR;\r
-                       $in_subdir = 0;\r
-               }\r
-       \r
-               if ($privateskins && (!is_dir($DIR_SKINS.$SKINSUBDIR))) {\r
-                       $oldumask = umask(0);\r
-                       mkdir($DIR_SKINS.$SKINSUBDIR, 0755);\r
-                       umask($oldmask);\r
-               }\r
-\r
-               if (!is_dir($currdir)) {\r
-                       echo 'The specified location is not a directory or doesn\'t exist.';\r
-                       return;\r
-               }\r
-               \r
-               if ($dh = @opendir($currdir)) { \r
-                       while (($file = readdir($dh)) !== false) { \r
-                               if(!preg_match("/^\.{1,2}/", $file)){\r
-                                       if (is_dir($currdir.$file)) {\r
-                                               $dirs[] = $file;\r
-                                       } else {\r
-                                               $files[] = $file;\r
-                                       }\r
-                               }\r
-                       }\r
-                       closedir($dh); \r
-               } \r
-               \r
-               echo "<h3>Current Directory: <b>/$newdir</b></h3>";\r
-               \r
-               if ($msg) {\r
-                       echo '<p><b>'.htmlspecialchars($msg).'</b></p>';\r
-               }\r
-               \r
-               if ($newdir != '') {\r
-                       echo "<u><a href=\"$pluginsskinfiles/\">> Return to / <</a></u><br />";\r
-                       if (strstr($newdir, '/')) {\r
-                               $splitpath =  preg_split( "/\//", strrev($newdir), 2);\r
-                               $updir = strrev($splitpath[1]);\r
-                               echo "<u><a href=\"$pluginsskinfiles/?dir=/$updir\">> Return to /$updir <</a></u><br /><br />";\r
-                       }\r
-               }\r
-               echo "<u><a href=\"$pluginsskinfiles/?dir=$newdir\">> Refresh <</a></u><br />";\r
-\r
-               echo "<table>";\r
-               if(is_array($dirs)){\r
-                       sort($dirs);\r
-                       foreach($dirs as $dir) {\r
-                               echo "<tr onmouseover='focusRow(this);' onmouseout='blurRow(this);'><td>";\r
-                               echo "&nbsp;&nbsp;<a href=\"$pluginsskinfiles/?dir=$newdir/$dir\">";\r
-                               echo "<img src=\"$pluginsskinfiles/dir.gif\"> $dir</a>&nbsp;</td>";\r
-                               echo "<td>&nbsp;<a href=\"$pluginsskinfiles/?action=rendir&oldname=$newdir/$dir\" title=\"Rename directory\">(ren)</a></td>";\r
-                               echo "<td>&nbsp;<a href=\"$pluginsskinfiles/?action=deldir&dir=$newdir&remdir=$newdir/$dir\" title=\"Delete directory\">(del)</a></td>";\r
-                               echo "</td><td></td><td></td><td></td><td>";\r
-                               echo "<td>".date('M d, Y  h:i:s a', filemtime($DIR_SKINS.$SKINSUBDIR.$newdir."/$dir"));\r
-                               echo "</td></tr>";\r
-                       }\r
-               }\r
-       \r
-               if(is_array($files)){\r
-                       sort($files);\r
-                       foreach($files as $file) {\r
-                               echo "<tr onmouseover='focusRow(this);' onmouseout='blurRow(this);'><td>";\r
-                               echo "&nbsp;&nbsp;";\r
-                               if (preg_match("/\.css$/i", $file)) {\r
-                                       echo "<img src=\"$pluginsskinfiles/css.gif\"> ";\r
-                               } elseif (preg_match("/\.php(3|4)?$/i", $file)) {\r
-                                       echo "<img src=\"$pluginsskinfiles/php.gif\"> ";\r
-                               } elseif (_isEditableFile($file)) {\r
-                                       echo "<img src=\"$pluginsskinfiles/text.gif\"> ";\r
-                               } elseif (_isImageFile($file)) {\r
-                                       echo "<img src=\"$pluginsskinfiles/image.gif\"> ";\r
-                               } else {\r
-                                       echo "<img src=\"$pluginsskinfiles/generic.png\"> ";\r
-                               }\r
-                               if ($newdir == '') {$thisdir = '';} else {$thisdir = "$newdir/";}\r
-                               echo "$file&nbsp;";\r
-                               echo "</td><td>";\r
-                               echo "&nbsp;<a href=\"$pluginsskinfiles/?action=renfile&rfp=$thisdir"."$file\" title=\"Rename file\">(ren)</a>";\r
-                               echo "</td><td>";\r
-                               echo "&nbsp;<a href=\"$pluginsskinfiles/?action=delfile&rfp=$thisdir"."$file\" title=\"Delete file\">(del)</a>";\r
-                               echo "</td><td>";\r
-                               if ((is_writable($DIR_SKINS.$SKINSUBDIR.$thisdir.$file)) && (!_isImageFile($file))) {\r
-                                       echo "&nbsp;<a href=\"$pluginsskinfiles/?action=editfile&rfp=$thisdir"."$file\" title=\"Edit file\">(edit)</a>";\r
-                               }\r
-                               echo "</td><td>";\r
-                               if (_isImageFile($file)) {\r
-                                       echo '&nbsp;<a href="'.$CONF['SkinsURL'].$SKINSUBDIR.$thisdir."$file\" title=\"View graphic\">(view)</a>";\r
-                               }\r
-                               echo "</td><td>";\r
-                               echo "&nbsp;<a href=\"$pluginsskinfiles/?action=download&rfp=$thisdir"."$file\" title=\"Download file\">(d/l)</a>";\r
-                               echo "</td><td>";\r
-                               echo number_format(filesize($DIR_SKINS.$SKINSUBDIR.$thisdir.$file)/1024, 2)." KB";\r
-                               echo "</td><td>";\r
-                               echo date('M d, Y  h:i:s a', filemtime($DIR_SKINS.$SKINSUBDIR.$thisdir.$file));\r
-                               echo "</td></tr>";\r
-                       }\r
-               }\r
-               echo "</table>";\r
-       \r
-               if(is_array($dirs) || is_array($files)) {\r
-                       if ($newdir != '') {\r
-                               echo "<u><a href=\"$pluginsskinfiles/\">> Return to / <</a></u><br />";\r
-                               if (strstr($newdir, '/')) {\r
-                                       $splitpath =  preg_split( "/\//", strrev($newdir), 2);\r
-                                       $updir = strrev($splitpath[1]);\r
-                                       echo "<u><a href=\"$pluginsskinfiles/?dir=/$updir\">> Return to /$updir <</a></u><br /><br />";\r
-                               }\r
-                       }\r
-                       echo "<u><a href=\"$pluginsskinfiles/?dir=$newdir\">> Refresh <</a></u><br />";\r
-               }\r
-\r
-               if ($newdir != '') {\r
-                       echo "<h3>Create new file in <b>/$newdir</b></h3>";\r
-                               ?>\r
-                               <form method="POST" enctype="multipart/form-data" action="<?php echo $pluginsskinfiles ?>/">\r
-                                               <input type="hidden" name="action" value="createfile" />\r
-                                               <input type="hidden" name="dir" value="<?php echo $newdir ?>">\r
-                                               <input type="text" name="filename" size="40">\r
-                                               <input type="submit" value="<?php echo 'Create file' ?>" />\r
-                                       </form>\r
-                               <?PHP\r
-\r
-                               echo "<h3>Upload new file to <b>/$newdir</b></h3>";\r
-                               ?>\r
-                               <form method="POST" enctype="multipart/form-data" action="<?php echo $pluginsskinfiles ?>/">\r
-                                               <input type="hidden" name="action" value="uploadfile" />\r
-                                               <input type="hidden" name="dir" value="<?php echo $newdir ?>">\r
-                                               <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $CONF['MaxUploadSize']?>" />\r
-                                               <input type="file" name="filename" size="40">\r
-                                               <input type="submit" value="<?php echo _UPLOAD_BUTTON?>" />\r
-                                       </form>\r
-                               <?PHP\r
-       \r
-                       if (count($files)) {\r
-                               echo "<h3>Delete all files in <b>/$newdir</b></h3>";\r
-                                       ?>\r
-                                               <form method="get" action="<?php echo $pluginsskinfiles?>/">\r
-                                                       <input type="hidden" name="action" value="deleteAllInDir" />\r
-                                                       <input type="hidden" name="dir" value="<?php echo $newdir?>"/>\r
-                                                       <?php echo "Delete all Files? (will ask for confirmation)"?>\r
-                                                       <input type="submit" tabindex="140" value="<?php echo "Delete All"?>" onclick="return checkSubmit();" />\r
-                                               </form>\r
-                                       <?PHP\r
-                       }\r
-               }\r
-       \r
-               echo "<h3>Create a new directory in <b>/$newdir</b></h3>"; \r
-                               ?>\r
-                                       <form method="post" action="<?php echo $pluginsskinfiles?>/">\r
-                                               <input type="hidden" name="action" value="createdir" />\r
-                                               <input type="hidden" name="dir" value="<?php echo $newdir?>"/>\r
-                                               <input name="newdir" tabindex="90" value="<?php echo 'newdir' ?>" size="40" />\r
-                                               <input type="submit" tabindex="140" value="<?php echo "Create"?>" onclick="return checkSubmit();" />\r
-                                       </form>\r
-                               <?PHP\r
-\r
-               // for MDNucleus, ignored if on Win32 platform (for the moment)\r
-               if (($newdir == '') && ($privateskins) && (!strtoupper(substr(PHP_OS, 0,3) == 'WIN'))) {\r
-                       if ($dh = @opendir($DIR_SKINS.$latestskins)) { \r
-                               while (($file = readdir($dh)) !== false) { \r
-                                       if(!preg_match("/^\.{1,2}/", $file))\r
-                                               if (is_dir($DIR_SKINS.$latestskins.$file)) $skins[] = $file;\r
-                               }\r
-                               closedir($dh); \r
-                       }\r
-                       if ($skins) {\r
-                               echo "<h3>Refresh default skin files to standard versions</h3>";\r
-                               ?>\r
-                                       <form method="post" action="<?php echo $pluginsskinfiles?>/">\r
-                                               <input type="hidden" name="action" value="getLatestSkins" />\r
-                                               <?php\r
-                                               sort ($skins);\r
-                                               if (count($skins) > 1) {\r
-                                                       $lastskin = array_pop($skins);\r
-                                                       array_push($skins, "</b>and<b> $lastskin");\r
-                                               }\r
-                                               echo "This will overwrite or create files in the following skin file directories: <b>";\r
-                                               echo implode(", ", $skins)."</b><br /><br />"; \r
-                                               ?> \r
-                                               Note that you may need to re-import skin definitions you wish to use (See Layout Import/Export).<br /><br />\r
-                                               <input type="checkbox" name="overwrite" value="1" id="cb_overwrite" />\r
-                                               <label for="cb_overwrite"><?php echo "Check this box to confirm overwrite of files<br />" ?></label>\r
-                                               <input type="submit" tabindex="140" value="<?php echo "Overwrite Default Skin Files"?>" onclick="return checkSubmit();" />\r
-                                       </form>\r
-                               <?PHP\r
-                       }\r
-               }\r
-\r
-       }\r
-\r
-       \r
-       \r
-?>
\ No newline at end of file
+<?php
+
+   /* ==========================================================================================
+       * Nucleus SkinFiles Plugin
+       *
+       * Copyright 2005-2007 by Jeff MacMichael and Niels Leenheer
+       *
+       * @version $Id: index.php,v 1.2 2007-03-22 09:16:11 kimitake Exp $
+       * @version $NucleusJP: index.php,v 1.6 2007/03/20 19:32:47 kmorimatsu Exp $
+       *
+       * ==========================================================================================
+       * This program is free software and open source 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.
+       *
+       * This program is distributed in the hope that it will be useful, but WITHOUT
+       * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+       * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+       * more details.
+       *
+       * You should have received a copy of the GNU General Public License along
+       * with this program; if not, write to the Free Software Foundation, Inc.,
+       * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA  or visit
+       * http://www.gnu.org/licenses/gpl.html
+       * ==========================================================================================
+       */
+
+       $strRel = '../../../'; 
+       require($strRel . 'config.php');
+       include($DIR_LIBS . 'PLUGINADMIN.php');
+
+       $language = ereg_replace( '[\\|/]', '', getLanguageName());
+       $langfile = $language.'.php';
+       if (file_exists($langfile))
+               include_once($langfile);
+       else
+               include_once('english.php');
+
+       /**
+         * Create admin area
+         */
+
+       $oPluginAdmin  = new PluginAdmin('SkinFiles');
+
+       if (!($member->isLoggedIn() && $member->isAdmin()))
+       {
+               $oPluginAdmin->start();
+               echo '<p>' . _ERROR_DISALLOWED . '</p>';
+               $oPluginAdmin->end();
+               exit;
+       }
+
+
+       
+       /**
+         * Setup main variables
+         */
+
+       $rootDirectory = sfRealPath($DIR_SKINS);                        
+       $rootUrl       = $CONF['SkinsURL'];
+       $pluginUrl         = $oPluginAdmin->plugin->getAdminURL();
+
+       $filetypes = array (
+               'text'  => array ('inc', 'txt', 'css', 'js', 'php'),
+               'html'  => array ('htm', 'html'),
+               'img'   => array ('png', 'gif', 'jpg', 'jpeg', 'bmp', 'ico', 'swf'),
+       );
+       
+       
+       /**
+         * Bypass admin area for downloads
+         */
+       
+       $action = requestVar('action');
+
+       if ($action == 'download') { 
+               _skinfiles_download();
+               exit;
+       }
+
+
+       /**
+         * Build admin area
+         */
+
+       $oPluginAdmin->start("<style type='text/css'>
+       <!--
+       
+               div#content a {
+                       text-decoration: none;
+               }
+               div#content img {
+                       vertical-align: middle;
+                       margin-top: -3px;
+               }
+               p.message {
+                       font-weight: bold;
+               }
+               p.error {
+                       font-size: 100%;
+                       font-weight: bold;
+                       color: #880000;
+               }
+               pre {
+                       overflow: auto;
+                       height: 400px;
+               }
+               iframe {
+                       width: 100%;
+                       height: 400px;
+                       border: 1px solid gray;
+               }
+               div.dialogbox {
+                       border: 1px solid #ddd;
+                       background-color: #F6F6F6;
+                       margin: 18px 0 1.5em 0;
+               }
+               div.dialogbox h4 {
+                       background-color: #bbc;
+                       color: #000;
+                       margin: 0;
+                       padding: 5px;
+               }
+               div.dialogbox h4.light {
+                       background-color: #ddd;
+               }
+               div.dialogbox div {
+                       margin: 0;
+                       padding: 10px;
+               }
+               div.dialogbox button {
+                       margin: 10px 0 0 6px;
+                       float: right;
+               }
+               div.dialogbox p {
+                       margin: 0;
+               }
+               div.dialogbox p.buttons {
+                       text-align: right;
+                       overflow: auto;
+               }
+               div.dialogbox textarea {
+                       width: 100%;
+                       margin: 0;
+               }
+       
+       -->
+       </style>");
+       
+       echo "<h2>" . _SKINFILES_MANAGEMENT . "</h2>";
+       
+       $actions = array (
+               'renfile', 'renfile_process', 'delfile', 'delfile_process', 
+               'editfile', 'editfile_process', 'uploadfile', 'createfile', 'viewfile',
+               'rendir', 'rendir_process', 'deldir', 'deldir_process',
+               'emptydir', 'emptydir_process', 'createdir'
+       );
+       
+       if (in_array($action, $actions)) 
+       { 
+               if (!$manager->checkTicket())
+               {
+                       echo '<p class="error">Error: ' . _ERROR_BADTICKET . '</p>';
+                       sfShowDirectory();
+                       
+               } 
+               else 
+               {
+                       call_user_func('_skinfiles_' . $action);
+               }
+       } 
+       else 
+       {
+               sfShowDirectory();
+       }
+
+       $oPluginAdmin->end();
+       exit;
+       
+       
+
+
+
+
+
+       /* Helper functions **************************************************************************************************************/
+
+       function sfExpandDirectory ($path) {
+          /* IN:  relative directory
+               * OUT: full path to directory
+               */
+
+               global $rootDirectory;
+               return sfRealPath($rootDirectory . $path);
+       }
+       
+       function sfRealPath ($path) {
+          /* IN:  full path 
+               * OUT: canonicalized absolute pathname
+               */
+
+               $path = realpath($path);
+               $path = str_replace('\\', '/', $path);  
+               $path = substr($path, strlen($path) - 1) != '/' ? $path . '/' : $path;
+               return $path;
+       }
+
+       function sfFullUrl ($path) {
+          /* IN:  full path including filename
+               * OUT: url including filename
+               */
+
+               global $rootDirectory, $rootUrl;
+               
+               $path = str_replace($rootDirectory, '', $path);
+               $path = rawurlencode($path);
+               $path = str_replace('%2F', '/', $path);
+               return $rootUrl . $path;
+       }
+
+       function sfValidPath ($path) {
+          /* IN:  full path excluding or including filename
+               * OUT: boolean, true if full path is or is within rootDirectory
+               */
+
+               global $rootDirectory;
+               return substr($path, 0, strlen($rootDirectory)) == $rootDirectory;
+       }
+       
+       function sfRelativePath ($path) {
+          /* IN:  full path including or excluding filename
+               * OUT: relative path from rootDirectory
+               */
+
+               global $rootDirectory;
+               return str_replace($rootDirectory, '', $path);
+       }
+       
+       function sfIsFileType ($type, $file) {
+
+               global $filetypes;
+               return isset($filetypes[$type]) && in_array(strtolower(substr(strrchr($file, "."), 1)), $filetypes[$type]);
+       }
+
+       function sfAllowEditing ($file) {
+               return sfIsFileType('html', $file) || sfIsFileType('text', $file);
+       }
+       
+       function sfAllowViewing ($file) {
+               return sfIsFileType('html', $file) || sfIsFileType('text', $file) || sfIsFileType('img', $file);
+       }
+
+
+       function sfDisplayPath ($relative) {
+       
+               global $pluginUrl;
+               
+               $result  = '<a href="' . htmlspecialchars($pluginUrl) . '" title="Go back to &laquo;skins&raquo;">';
+               $result .= '<img src="' . htmlspecialchars($pluginUrl . 'home.gif') . '" alt="" /> skins</a> / ';
+
+               $parts = explode('/', $relative);
+               $part = '';
+               
+               while (list(,$v) = each ($parts)) {
+                       if ($v != '') {
+                               $part .= $v . '/';
+                               
+                               $result .= '<a href="' . htmlspecialchars($pluginUrl . '?dir=' . rawurlencode($part)) . '" ';
+                               $result .= 'title="Go back to &laquo;' . htmlspecialchars($v) . '&raquo;">';
+                               $result .= '<img src="' . htmlspecialchars($pluginUrl . 'dir.gif') . '" alt="" /> ';
+                               $result .= htmlspecialchars($v) . '</a> / ';
+                       }
+               }
+               
+               return $result;
+       }
+
+       function sfIcon ($file) {
+       
+               global $pluginUrl;
+       
+               $ext = strtolower(substr(strrchr($file, "."), 1));
+               
+               switch ($ext) {
+                       case 'htm':
+                       case 'html':
+                               return $pluginUrl . 'html.gif';
+                               break;
+
+                       case 'txt':
+                       case 'js':
+                       case 'css':
+                       case 'inc':
+                               return $pluginUrl . 'text.gif';
+                               break;
+
+                       case 'gif':
+                       case 'png':
+                       case 'jpg':
+                       case 'jpeg':
+                       case 'bmp':
+                       case 'xbmp':
+                       case 'ico':
+                               return $pluginUrl . 'image.gif';
+                               break;
+
+                       case 'php':
+                       case 'php3':
+                       case 'php4':
+                               return $pluginUrl . 'php.gif';
+                               break;
+                               
+                       default:
+                               return $pluginUrl . 'generic.gif';
+                               break;
+               }
+       }
+
+       function sfIllegalFilename($name) {
+               return preg_match('#[\n\r\\\/\:\*\?\"\<\>\|]#', $name);
+       }
+
+       function sfDirectoryIsEmpty($dir) {
+               
+               $count = 0;
+               
+               if ($dh = opendir($dir)) 
+               {
+                       while (($file = readdir($dh)) !== false) 
+                               $count++;
+                       
+                       closedir($dh);
+               }
+               
+               // $count must be smaller or equal than 2, because '.' 
+               // and '..' are always returned by readdir().
+               return $count <= 2;
+       }
+
+
+
+
+
+
+
+
+
+       /* Show directory ****************************************************************************************************************/
+
+       function sfShowDirectory($default = '') {
+
+               global $pluginUrl, $rootDirectory, $CONF, $manager;
+               
+               $directory = $default != '' ? 
+                       $default : 
+                       sfExpandDirectory(trim(requestVar('dir')));
+               
+               if (!sfValidPath($directory) || !is_dir($directory)) {
+                       $directory = $rootDirectory;
+               }
+
+               $relative  = sfRelativePath ($directory);
+               
+               echo '<p class="location">' . _SKINFILES_CURRENT_LOCATION . sfDisplayPath($relative) . '</p>';                  
+
+                       
+               $dirs = array();
+               $files = array();
+
+               if ($dh = @opendir($directory)) { 
+                       while (($file = readdir($dh)) !== false) { 
+                               if (!preg_match("/^\.{1,2}$/", $file)) {
+                                       $fstat = @stat($directory . $file);
+                               
+                                       if ($fstat['mode'] & 040000)
+                                               $dirs[$file] = $fstat;
+                                       else
+                                               $files[$file] = $fstat;
+                               }
+                       }
+                       closedir($dh); 
+               }                       
+               
+               ksort($dirs);
+               ksort($files);
+               
+               echo '<table><thead><tr>';
+               echo '<th>' . _SKINFILES_NAME . '</th><th>' . _SKINFILES_SIZE . '</th><th>' . _SKINFILES_LAST_MODIFIED . '</th><th colspan="4">' . _SKINFILES_ACTIONS . '</th>';
+               echo '</tr></thead>';
+
+               while (list($name, $stat) = each($dirs)) {
+                       
+                       $dir = sfRelativePath($directory . $name . '/');
+                               
+                       echo '<tr onmouseover="focusRow(this);" onmouseout="blurRow(this);"><td>';
+                       
+                       if (is_readable ($directory . $name)) 
+                       {
+                               echo '<a href="' . htmlspecialchars($pluginUrl . '?dir=' . rawurlencode($dir)) . '">';
+                               echo '<img src="' . htmlspecialchars($pluginUrl . 'dir.gif') . '" alt="folder" /> ';
+                               echo htmlspecialchars($name).'</a>';                    
+                       }
+                       else
+                       {
+                               echo '<img src="' . htmlspecialchars($pluginUrl . 'dir.gif') . '" alt="folder" /> ';
+                               echo htmlspecialchars($name);                   
+                       }
+                                               
+                       echo '</td>';
+                               
+                       $renUrl = $manager->addTicketToUrl($pluginUrl . '?action=rendir&dir=' . rawurlencode($dir));
+                       $delUrl = $manager->addTicketToUrl($pluginUrl . '?action=deldir&dir=' . rawurlencode($dir));
+                               
+                       echo '<td>&ndash;</td>';
+                       echo '<td>' . date(_SKINFILES_DATE_FORMAT, $stat['mtime']);
+                       
+                       
+                       if (is_writable($directory . $name)) {
+                               echo '<td><a href="' . htmlspecialchars($renUrl) . '" title="' . _SKINFILES_RENAME . ' &laquo;' . htmlspecialchars($name) . '&raquo;">' . _SKINFILES_RENAME . '</a></td>';
+                       } else {
+                               echo '<td>&nbsp;</td>';
+                       }
+                       
+                       if (is_writable($directory . $name) && sfDirectoryIsEmpty($directory . $name)) {
+                               echo '<td><a href="' . htmlspecialchars($delUrl) . '" title="' . _SKINFILES_DELETE . ' &laquo;' . htmlspecialchars($name) . '&raquo;">' . _SKINFILES_DELETE . '</a></td>';
+                       } else {
+                               echo '<td>&nbsp;</td>';
+                       }
+                       
+                       echo '<td>&nbsp;</td><td>&nbsp;</td>';
+                       echo '</tr>';
+               }
+
+
+               while (list($name, $stat) = each($files)) {
+
+                       $file = sfRelativePath($directory . $name);
+
+                       $renUrl   = $manager->addTicketToUrl($pluginUrl . '?action=renfile&file='  . rawurlencode($file));
+                       $delUrl   = $manager->addTicketToUrl($pluginUrl . '?action=delfile&file='  . rawurlencode($file));
+                       $editUrl  = $manager->addTicketToUrl($pluginUrl . '?action=editfile&file=' . rawurlencode($file));
+                       $viewUrl  = $manager->addTicketToUrl($pluginUrl . '?action=viewfile&file=' . rawurlencode($file));
+                       $dlUrl    = $manager->addTicketToUrl($pluginUrl . '?action=download&file=' . rawurlencode($file));
+
+                       echo '<tr onmouseover="focusRow(this);" onmouseout="blurRow(this);"><td>';
+                       
+                       if (is_readable ($directory . $name) && sfAllowViewing($name)) 
+                       {
+                               echo '<a href="' . htmlspecialchars($viewUrl) . '">';
+                               echo '<img src="' . htmlspecialchars(sfIcon($name)) . '" alt="" /> ';
+                               echo htmlspecialchars($name).'</a>';
+                       }
+                       else
+                       {
+                               echo '<img src="' . htmlspecialchars(sfIcon($name)) . '" alt="" /> ';
+                               echo htmlspecialchars($name);
+                       }
+
+                       echo '</td><td>';
+                       echo ceil($stat['size'] / 1024) . ' kB';
+                       echo '</td><td>';
+                       echo date(_SKINFILES_DATE_FORMAT, $stat['mtime']);
+                       echo '</td><td>';
+                               
+                       if (is_writable($directory . $name)) {
+                               echo '<a href="' . htmlspecialchars($renUrl) . '" title="' . _SKINFILES_RENAME . ' &laquo;' . htmlspecialchars($name) . '&raquo;">' . _SKINFILES_RENAME . '</a>';
+                       } else {
+                               echo '&nbsp;';
+                       }
+                               
+                       echo '</td><td>';
+
+                       if (is_writable($directory . $name)) {
+                               echo '<a href="' . htmlspecialchars($delUrl) . '" title="' . _SKINFILES_DELETE . ' &laquo;' . htmlspecialchars($name) . '&raquo;">' . _SKINFILES_DELETE . '</a>';
+                       } else {
+                               echo '&nbsp;';
+                       }
+                               
+                       echo '</td><td>';
+                       
+                       if (is_writable($directory . $name) && sfAllowEditing($name))
+                               echo '<a href="'. htmlspecialchars($editUrl) . '" title="' . _SKINFILES_EDIT . ' &laquo;' . htmlspecialchars($name) . '&raquo;">' . _SKINFILES_EDIT . '</a>';
+                       else
+                               echo '&nbsp;';
+
+                       echo '</td><td>';
+                       
+                       if (is_readable ($directory . $name))
+                               echo '<a href="' . htmlspecialchars($dlUrl) . '" title="' . _SKINFILES_DOWNLOAD . ' &laquo;' . htmlspecialchars($name) . '&raquo;">' . _SKINFILES_DOWNLOAD . '</a>';
+                       else
+                               echo '&nbsp;';
+                               
+                       echo '</td></tr>';
+               }
+
+               if (!count($dirs) && !count($files)) {
+                       echo '<tr><td colspan="7">' . _SKINFILES_ERR_DIR_DOES_NOT_CONTAIN . '</td></tr>';
+               }
+
+               echo '</table>';
+
+               if ($relative != '') {
+               
+                       if (is_writable($directory)) {
+                               echo '<div class="dialogbox">';
+                               echo '<h4 class="light">' . _SKINFILES_CREATE_NEW_FILE . '</h4><div>';
+                               echo '<form method="post" action="' . htmlspecialchars($pluginUrl) . '">';
+                               $manager->addTicketHidden();
+                               echo '<input type="hidden" name="action" value="createfile" />';
+                               echo '<input type="hidden" name="dir" value="' . htmlspecialchars($relative) . '" />';
+                               echo '<input type="text" name="name" size="40" value="untitled.txt" />';
+                               echo '<p class="buttons"><input type="submit" value="' . _SKINFILES_CREATE_FILE . '" /></p></form>';
+                               echo '</div></div>';
+       
+                               echo '<div class="dialogbox">';
+                               echo '<h4 class="light">' . _SKINFILES_UPLOAD_NEW_FILE . '</h4><div>';
+                               echo '<form method="post" enctype="multipart/form-data" action="' . htmlspecialchars($pluginUrl) . '">';
+                               $manager->addTicketHidden();
+                               echo '<input type="hidden" name="action" value="uploadfile" />';
+                               echo '<input type="hidden" name="dir" value="' . htmlspecialchars($relative) . '" />';
+                               echo '<input type="hidden" name="MAX_FILE_SIZE" value="' . $CONF['MaxUploadSize'] . '" />';
+                               echo '<input type="file" name="name" size="40" />';
+                               echo '<p class="buttons"><input type="submit" value="' . _SKINFILES_UPLOAD . '" /></p></form>';
+                               echo '</div></div>';
+                       }
+       
+                       if (count($files)) {
+                               echo '<div class="dialogbox">';
+                               echo '<h4 class="light">' . _SKINFILES_DEL_ALL_FILES . '</h4><div>';
+                               echo '<form method="post" action="' . htmlspecialchars($pluginUrl) . '">';
+                               $manager->addTicketHidden();
+                               echo '<input type="hidden" name="action" value="emptydir" />';
+                               echo '<input type="hidden" name="dir" value="' . htmlspecialchars($relative) . '" />';
+                               echo _SKINFILES_DEL_ALL_FILES_MSG;
+                               echo '<p class="buttons"><input type="submit" value="' . _SKINFILES_DELETE_ALL . '" tabindex="140" onclick="return checkSubmit();" /></p>';
+                               echo '</form>';
+                               echo '</div></div>';
+                       }
+               }
+       
+               if (is_writable($directory)) {
+                       echo '<div class="dialogbox">';
+                       echo '<h4 class="light">' . _SKINFILES_CREATE_NEW_DIR . '</h4><div>';
+                       echo '<form method="post" action="' . htmlspecialchars($pluginUrl) . '">';
+                       $manager->addTicketHidden();
+                       echo '<input type="hidden" name="action" value="createdir" />';
+                       echo '<input type="hidden" name="dir" value="' . htmlspecialchars($relative) . '" />';
+                       echo '<input type="text" name="name" value="untitled" tabindex="90" size="40" />';
+                       echo '<p class="buttons"><input type="submit" value="' . _SKINFILES_CREATE . '" tabindex="140" onclick="return checkSubmit();" /></p>';
+                       echo '</form>';
+                       echo '</div></div>';
+               }
+       }
+       
+       
+       
+
+       /* Rename directory **************************************************************************************************************/
+
+       function _skinfiles_rendir($preset = '') {
+
+               global $pluginUrl, $manager;
+               
+               $file      = trim(basename(requestVar('dir')));
+               $directory = trim(dirname(requestVar('dir')));
+               $directory = sfExpandDirectory ($directory);
+               
+               if (sfValidPath($directory . $file) && file_exists($directory . $file) && 
+                       is_dir($directory . $file) && is_writable($directory . $file)) 
+               {
+                       $relative = sfRelativePath ($directory);
+                       $editUrl  = $manager->addTicketToUrl($pluginUrl . '?action=rendir&dir=' . rawurlencode($relative . $file));
+
+                       echo '<p class="location">' . _SKINFILES_CURRENT_LOCATION . sfDisplayPath($relative);
+                       echo '<a href="' . htmlspecialchars($editUrl) . '" title="' . _SKINFILES_RENAME . ' &laquo;' . $file . '&raquo;">';
+                       echo '<img src="' . $pluginUrl . 'dir.gif' . '" alt="" /> ' . $file . '</a></p>';
+
+                       echo '<div class="dialogbox">';
+                       echo '<form method="post" action="' . htmlspecialchars($pluginUrl) . '">';
+                       $manager->addTicketHidden();
+                       echo '<input type="hidden" name="action" value="rendir_process" />';
+                       echo '<input type="hidden" name="dir" value="' . htmlspecialchars($relative . $file) . '" />';
+
+                       echo '<h4>' . _SKINFILES_RENAME_DIR_MSG . ' &laquo;' . htmlspecialchars($file) . '&raquo; ' . _SKINFILES_RENAME_DIR_MSG2 . '</h4><div>';
+                       echo '<p><input type="text" name="name" size="40" value="' . htmlspecialchars($preset != '' ? $preset : $file) . '" /></p>';
+                       echo '<p class="buttons">';
+                       echo '<input type="hidden" name="sure" value="yes" />';
+                       echo '<input type="submit" value="' . _SKINFILES_RENAME . '" />';
+                       echo '<input type="button" name="sure" value="' . _SKINFILES_CANCEL . '" onclick="history.back();" />';
+                       echo '</p>';
+                       echo '</div></form></div>';
+               }
+               else
+               {
+                       echo "<p class='error'>" . _SKINFILES_ERR_DIR_DOES_NOT_EXIST1 . " &laquo;" . htmlspecialchars($file) . "&raquo; " . _SKINFILES_ERR_DIR_DOES_NOT_EXIST2;
+                       echo _SKINFILES_ERR_DIR_DOES_NOT_EXIST3 . "</p>";
+               }
+       }
+       
+       function _skinfiles_rendir_process() {
+
+               global $pluginUrl, $manager;
+               
+               $file      = trim(basename(requestVar('dir')));
+               $directory = trim(dirname(requestVar('dir')));
+               $directory = sfExpandDirectory ($directory);
+               
+               if (requestVar('sure') == 'yes')
+               {
+                       if (sfValidPath($directory . $file) && file_exists($directory . $file) && 
+                               is_dir($directory . $file) && is_writable($directory . $file)) 
+                       {
+                               $name = requestVar('name');
+                               
+                               if ($name == '') {
+                                       echo "<p class='error'>" . _SKINFILES_ERR_COULD_NOT_RENAME_DIR1 . "&laquo;" . htmlspecialchars($file) . "&raquo; ";
+                                       echo _SKINFILES_ERR_COULD_NOT_RENAME_DIR2 . "</p>";
+                                       _skinfiles_rendir($name);
+                                       return;
+                               }
+                               
+                               if (sfIllegalFilename($name)) {
+                                       echo "<p class='error'>" . _SKINFILES_ERR_COULD_NOT_RENAME_DIR3 . "&laquo;" . htmlspecialchars($file) . "&raquo; ";
+                                       echo _SKINFILES_ERR_COULD_NOT_RENAME_DIR4 . "</p>";
+                                       _skinfiles_rendir($name);
+                                       return;
+                               } 
+                               
+                               if ($name == $file) {
+                                       echo "<p class='error'>" . _SKINFILES_ERR_COULD_NOT_RENAME_DIR5 . "&laquo;" . htmlspecialchars($file) . "&raquo; ";
+                                       echo _SKINFILES_ERR_COULD_NOT_RENAME_DIR6 . _SKINFILES_ERR_COULD_NOT_RENAME_DIR7 . "</p>";
+                                       _skinfiles_rendir($name);
+                                       return;
+                               }
+                               
+                               if (file_exists($directory . $name)) {
+                                       echo "<p class='error'>" . _SKINFILES_ERR_COULD_NOT_RENAME_DIR8 . "&laquo;" . htmlspecialchars($file) . "&raquo; ";
+                                       echo _SKINFILES_ERR_COULD_NOT_RENAME_DIR9 . _SKINFILES_ERR_COULD_NOT_RENAME_DIR10 . "</p>";
+                                       _skinfiles_rendir($name);
+                                       return;
+                               }
+                               
+                               if (!@rename($directory . $file, $directory . $name)) 
+                               {
+                                       echo "<p class='error'>" . _SKINFILES_ERR_COULD_NOT_RENAME_DIR11 . "&laquo;" . htmlspecialchars($file) . "&raquo;</p>";
+                                       _skinfiles_rendir($name);
+                                       return;
+                               }
+       
+                               echo "<p class='message'>" . _SKINFILES_RENAMED_DIR1 . "&laquo;" . htmlspecialchars($file) . "&raquo; " . _SKINFILES_RENAMED_DIR2;
+                               echo _SKINFILES_RENAMED_DIR3 . "&laquo;" . htmlspecialchars($name) . "&raquo;" . _SKINFILES_RENAMED_DIR4 . "</p>";
+                               sfShowDirectory($directory);
+                       }               
+                       else
+                       {
+                               echo "<p class='error'>" . _SKINFILES_ERR_DIR_DOES_NOT_EXIST1 . "&laquo;" . htmlspecialchars($file) . "&raquo; " . _SKINFILES_ERR_DIR_DOES_NOT_EXIST2;
+                               echo _SKINFILES_ERR_DIR_DOES_NOT_EXIST3 . "</p>";
+                       }
+               }
+               else
+               {
+                       // User cancelled
+                       sfShowDirectory($directory);
+               }
+       }
+
+
+
+
+       /* Create directory **************************************************************************************************************/
+
+       function _skinfiles_createdir() {
+       
+               $directory = trim(requestVar('dir'));
+               $directory = sfExpandDirectory($directory);
+
+               if (sfValidPath($directory) && is_dir($directory) && is_writable($directory)) 
+               {
+                       $name = requestVar('name');
+                       
+                       if ($name == '') {
+                               echo "<p class='error'>" . _SKINFILES_ERR_COULD_NOT_CREATE_DIR1 . "</p>";
+                               sfShowDirectory($directory);
+                               return;
+                       }
+                       
+                       if (sfIllegalFilename($name)) {
+                               echo "<p class='error'>" . _SKINFILES_ERR_COULD_NOT_CREATE_DIR2 . "&laquo;" . htmlspecialchars($name) . "&raquo; ";
+                               echo _SKINFILES_ERR_COULD_NOT_CREATE_DIR3 . "</p>";
+                               sfShowDirectory($directory);
+                               return;
+                       } 
+                       
+                       if (file_exists($directory . $name)) {
+                               echo "<p class='error'>" . _SKINFILES_ERR_COULD_NOT_CREATE_DIR4 . "&laquo;" . htmlspecialchars($name) . "&raquo; ";
+                               echo _SKINFILES_ERR_COULD_NOT_CREATE_DIR5 . _SKINFILES_ERR_COULD_NOT_CREATE_DIR6 . "</p>";
+                               sfShowDirectory($directory);
+                               return;
+                       }
+                       
+                       $mask = @umask(0000);
+
+                       if (!@mkdir($directory . $name, 0755)) 
+                       {
+                               echo "<p class='error'>" . _SKINFILES_ERR_COULD_NOT_CREATE_DIR2 . "&laquo;" . htmlspecialchars($name) . "&raquo;</p>";
+                               sfShowDirectory($directory);
+                               return;
+                       }
+
+                       @umask($mask);
+                       
+                       echo "<p class='message'>" . _SKINFILES_ERR_COULD_NOT_CREATE_DIR7 . "&laquo;" . htmlspecialchars($name) . "&raquo; " . _SKINFILES_ERR_COULD_NOT_CREATE_DIR8 . "</p>";
+                       sfShowDirectory($directory);
+               }               
+               else
+               {
+                       echo "<p class='error'>" . _SKINFILES_ERR_COULD_NOT_CREATE_DIR9 . "&laquo;" . htmlspecialchars(basename($directory)) . "&raquo; " .  _SKINFILES_ERR_COULD_NOT_CREATE_DIR10;
+                       echo _SKINFILES_ERR_COULD_NOT_CREATE_DIR11 . "</p>";
+               }
+       }
+       
+       
+       
+
+       /* Delete directory **************************************************************************************************************/
+
+       function _skinfiles_deldir() {
+
+               global $pluginUrl, $manager;
+               
+               $file      = trim(basename(requestVar('dir')));
+               $directory = trim(dirname(requestVar('dir')));
+               $directory = sfExpandDirectory ($directory);
+               
+               if (sfValidPath($directory . $file) && file_exists($directory . $file) && 
+                       is_dir($directory . $file) && is_writable($directory . $file) &&
+                       sfDirectoryIsEmpty($directory . $file)) 
+               {
+                       $relative = sfRelativePath ($directory);
+                       $delUrl  = $manager->addTicketToUrl($pluginUrl . '?action=deldir&dir=' . rawurlencode($relative . $file));
+
+                       echo '<p class="location">' . _SKINFILES_CURRENT_LOCATION . sfDisplayPath($relative);
+                       echo '<a href="' . htmlspecialchars($delUrl) . '" title="' . _SKINFILES_DELETE . ' &laquo;' . $file . '&raquo;">';
+                       echo '<img src="' . $pluginUrl . 'dir.gif' . '" alt="" /> ' . $file . '</a></p>';
+
+                       echo '<div class="dialogbox">';
+                       echo '<form method="post" action="' . htmlspecialchars($pluginUrl) . '">';
+                       $manager->addTicketHidden();
+                       echo '<input type="hidden" name="action" value="deldir_process" />';
+                       echo '<input type="hidden" name="dir" value="' . htmlspecialchars($relative . $file) . '" />';
+
+                       echo '<h4>' . _SKINFILES_DELETE_DIR . ' &laquo;' . htmlspecialchars($file) . '&raquo; ' . _SKINFILES_DELETE_DIR2 . '</h4><div>';
+                       echo '<p class="buttons">';
+                       echo '<input type="hidden" name="sure" value="yes" />';
+                       echo '<input type="submit" value="' . _SKINFILES_DELETE . '" />';
+                       echo '<input type="button" name="sure" value="' . _SKINFILES_CANCEL . '" onclick="history.back();" />';
+                       echo '</p>';
+                       echo '</div></form></div>';
+               }
+               else
+               {
+                       echo "<p class='error'>" . _SKINFILES_ERR_DELETE_DIR1 . " &laquo;" . htmlspecialchars($file) . "&raquo; " . _SKINFILES_ERR_DELETE_DIR2;
+                       echo _SKINFILES_ERR_DELETE_DIR3 . "</p>";
+               }
+       }
+       
+       function _skinfiles_deldir_process() {
+
+               global $pluginUrl, $manager;
+               
+               $file      = trim(basename(requestVar('dir')));
+               $directory = trim(dirname(requestVar('dir')));
+               $directory = sfExpandDirectory ($directory);
+               
+               if (requestVar('sure') == 'yes')
+               {
+                       if (sfValidPath($directory . $file) && file_exists($directory . $file) && 
+                               is_dir($directory . $file) && is_writable($directory . $file) &&
+                               sfDirectoryIsEmpty($directory . $file)) 
+                       {
+                               if (!@rmdir($directory . $file)) 
+                               {
+                                       echo "<p class='error'>" . _SKINFILES_ERR_DELETE_DIR4 . "&laquo;" . htmlspecialchars($file) . "&raquo;</p>";
+                                       sfShowDirectory($directory);
+                                       return;
+                               }
+       
+                               echo "<p class='message'>" . _SKINFILES_ERR_DELETE_DIR5 . "&laquo;" . htmlspecialchars($file) . "&raquo; " . _SKINFILES_ERR_DELETE_DIR6 . "</p>";
+                               sfShowDirectory($directory);
+                       }               
+                       else
+                       {
+                               echo "<p class='error'>" . _SKINFILES_ERR_DELETE_DIR1 . "&laquo;" . htmlspecialchars($file) . "&raquo; " . _SKINFILES_ERR_DELETE_DIR2;
+                               echo _SKINFILES_ERR_DELETE_DIR3 . "</p>";
+                       }
+               }
+               else
+               {
+                       // User cancelled
+                       sfShowDirectory($directory);
+               }
+       }       
+       
+       
+       
+       
+       /* Empty directory ***************************************************************************************************************/
+
+       function _skinfiles_emptydir() {
+
+               global $pluginUrl, $manager;
+               
+               $file      = trim(basename(requestVar('dir')));
+               $directory = trim(dirname(requestVar('dir')));
+               $directory = sfExpandDirectory ($directory);
+               
+               if (sfValidPath($directory . $file) && file_exists($directory . $file) && is_dir($directory . $file)) 
+               {
+                       $files = array();
+       
+                       if ($dh = @opendir($directory . $file)) 
+                       { 
+                               while (($name = readdir($dh)) !== false) {
+                                       if(!preg_match("/^\.{1,2}$/", $name) && 
+                                          !is_dir($directory . $file . '/' . $name) &&
+                                          is_writable($directory . $file . '/' . $name)) 
+                                                       $files[] = $name;
+                               }
+                               
+                               closedir($dh); 
+                               sort($files);
+                       }
+                       
+                       $relative = sfRelativePath ($directory);
+                       $emptyUrl  = $manager->addTicketToUrl($pluginUrl . '?action=emptydir&dir=' . rawurlencode($relative . $file));
+
+                       echo '<p class="location">' . _SKINFILES_CURRENT_LOCATION . sfDisplayPath($relative);
+                       echo '<a href="' . htmlspecialchars($emptyUrl) . '" title="Empty &laquo;' . $file . '&raquo;">';
+                       echo '<img src="' . $pluginUrl . 'dir.gif' . '" alt="" /> ' . $file . '</a></p>';
+
+                       echo '<div class="dialogbox">';
+                       echo '<form method="post" action="' . htmlspecialchars($pluginUrl) . '">';
+                       $manager->addTicketHidden();
+                       echo '<input type="hidden" name="action" value="emptydir_process" />';
+                       echo '<input type="hidden" name="dir" value="' . htmlspecialchars($relative . $file) . '" />';
+
+                       echo '<h4>' . _SKINFILES_DELETE_FILE_MSG . ' &laquo;' . htmlspecialchars($file) . '&raquo;' . _SKINFILES_DELETE_FILE_MSG2 . '</h4><div>';
+                       
+                       if (count($files)) 
+                       {
+                               echo '<ul>';
+                               foreach ($files as $name) {     echo '<li>' . htmlspecialchars($name) . '</li>'; }
+                               echo '</ul>';
+       
+                               echo '<p class="buttons">';
+                               echo '<input type="hidden" name="sure" value="yes" />';
+                               echo '<input type="submit" value="' . _SKINFILES_DELETE . '" />';
+                               echo '<input type="button" name="sure" value="' . _SKINFILES_CANCEL . '" onclick="history.back();" />';
+                               echo '</p>';
+                       }
+                       else
+                       {
+                               echo '<p>' . _SKINFILES_ERR_DELETE_DIR7 . '</p>';
+                               echo '<p class="buttons">';
+                               echo '<input type="button" name="sure" value="' . _SKINFILES_CANCEL . '" onclick="history.back();" />';
+                               echo '</p>';
+                       }
+                       
+                       echo '</div></form></div>';
+                       
+               }
+               else
+               {
+                       echo "<p class='error'>" . _SKINFILES_ERR_DELETE_DIR1 . "&laquo;" . htmlspecialchars($file) . "&raquo; " . _SKINFILES_ERR_DELETE_DIR2;
+                       echo _SKINFILES_ERR_DELETE_DIR3 . "</p>";
+               }
+       }
+
+       function _skinfiles_emptydir_process() {
+
+               global $pluginUrl, $manager;
+               
+               $file      = trim(basename(requestVar('dir')));
+               $directory = trim(dirname(requestVar('dir')));
+               $directory = sfExpandDirectory ($directory);
+               
+               if (requestVar('sure') == 'yes')
+               {
+                       if (sfValidPath($directory . $file) && file_exists($directory . $file) && is_dir($directory . $file)) 
+                       {
+                               if ($dh = @opendir($directory . $file)) 
+                               { 
+                                       while (($name = readdir($dh)) !== false) 
+                                       {
+                                               if(!preg_match("/^\.{1,2}$/", $name) &&  !is_dir($directory . $file . '/' . $name) &&
+                                                  is_writable($directory . $file . '/' . $name)) 
+                                               {
+                                                       if (unlink ($directory .$file . '/' . $name)) 
+                                                               echo "<p class='message'>" . _SKINFILES_ERR_EMPTY_DIR1 . "&laquo;" . htmlspecialchars($name) . "&raquo; " . _SKINFILES_ERR_EMPTY_DIR2 . "</p>";
+                                                       else
+                                                               echo "<p class='error'>" . _SKINFILES_ERR_EMPTY_DIR3 . "&laquo;" . htmlspecialchars($name) . "&raquo; " . _SKINFILES_ERR_EMPTY_DIR4 . "</p>";
+                                               }
+                                       }
+                                       
+                                       closedir($dh); 
+       
+                                       sfShowDirectory($directory . $file . '/');
+                               }
+                       }
+                       else
+                       {
+                               echo "<p class='error'>" . _SKINFILES_ERR_EMPTY_DIR5 . "&laquo;" . htmlspecialchars($file) . "&raquo; " . _SKINFILES_ERR_EMPTY_DIR6;
+                               echo _SKINFILES_ERR_EMPTY_DIR7 . "</p>";
+                       }
+               }
+               else
+               {
+                       // User cancelled
+                       sfShowDirectory($directory . $file . '/');
+               }
+       }
+
+
+
+
+       /* Download file *****************************************************************************************************************/
+
+       function _skinfiles_download() {
+
+               global $pluginUrl, $manager;
+               
+               $file = basename(trim(requestVar('file')));
+
+               $directory = dirname(trim(requestVar('file')));
+               $directory = sfExpandDirectory ($directory);
+               
+               if (sfValidPath($directory) && file_exists($directory . $file) && 
+                       is_file($directory . $file) && is_readable($directory . $file)) 
+               {
+                       if (strstr(serverVar('HTTP_USER_AGENT'), "MSIE"))
+                               $name = preg_replace('/\./', '%2e', $file, substr_count($file, '.') - 1);
+                       else
+                               $name = $file;
+                               
+                       if ($fp = @fopen($directory . $file, 'r')) {
+                               header("Cache-Control: ");      // leave blank to avoid IE errors
+                               header("Pragma: ");                     // leave blank to avoid IE errors
+                               header("Content-type: application/octet-stream");
+                               header('Content-Disposition: attachment; filename="'.$name.'"');
+                               header("Content-length: ".(string)(filesize($directory . $file)));
+                               sleep(1);
+                               
+                               fpassthru($fp);
+                               fclose($fp);
+                       }
+                       else
+                       {
+                               echo _SKINFILES_ERR_DOWNLOAD_FILE1;
+                       }
+               }
+               else
+               {
+                       echo _SKINFILES_ERR_DOWNLOAD_FILE2;
+               }
+
+               exit;
+       }
+
+
+
+
+       /* View file *********************************************************************************************************************/
+
+       function _skinfiles_viewfile() {
+
+               global $pluginUrl, $manager;
+               
+               $file      = basename(trim(requestVar('file')));
+               $directory = dirname(trim(requestVar('file')));
+               $directory = sfExpandDirectory ($directory);
+               
+               if (sfValidPath($directory) && file_exists($directory . $file) && 
+                       is_file($directory . $file) && is_readable($directory . $file) && sfAllowViewing($file)) 
+               {
+                       $relative = sfRelativePath ($directory);
+                       $viewUrl  = $manager->addTicketToUrl($pluginUrl . '?action=viewfile&file=' . rawurlencode(sfRelativePath($directory . $file)));
+
+                       echo '<p class="location">' . _SKINFILES_CURRENT_LOCATION . sfDisplayPath($relative);
+                       echo '<a href="' . htmlspecialchars($viewUrl) . '" title="View &laquo;' . $file . '&raquo;">';
+                       echo '<img src="' . htmlspecialchars(sfIcon($file)) . '" alt="" /> ' . $file . '</a></p>';
+
+                       echo '<h4>' . _SKINFILES_VIEW_FILE . '&laquo;' . htmlspecialchars($file) . '&raquo;</h4>';
+
+                       if (sfIsFileType('html', $file))
+                       {
+                               echo '<iframe src="' . sfFullUrl($directory . $file) . '"></iframe>';
+                       }
+
+                       if (sfIsFileType('text', $file))
+                       {
+                               $content = implode('', file($directory . $file));
+
+                               echo '<pre>';
+                               echo htmlspecialchars($content);
+                               echo '</pre>';
+                       }
+
+                       if (sfIsFileType('img', $file))
+                       {
+                               $size = getimagesize($directory . $file, $info);
+                               
+                               switch ($size[2]) {
+                                       case IMAGETYPE_GIF:             $type = 'GIF document'; break;
+                                       case IMAGETYPE_JPEG:    $type = 'JPEG photograph'; break;
+                                       case IMAGETYPE_PNG:             $type = 'PNG document'; break;
+                                       case IMAGETYPE_SWF:             $type = 'Flash animation'; break;
+                                       case IMAGETYPE_PSD:             $type = 'Photoshop document'; break;
+                                       case IMAGETYPE_BMP:             $type = 'BMP document'; break;
+                                       case IMAGETYPE_TIFF_II: $type = 'TIFF document (Intel Byte Order)'; break;
+                                       case IMAGETYPE_TIFF_MM: $type = 'TIFF document (Motorola Byte Order)'; break;
+                                       case IMAGETYPE_JPC:             $type = 'JPEG2000 photograph'; break;
+                                       case IMAGETYPE_JP2:     $type = 'JPEG2000 photograph'; break;
+                                       case IMAGETYPE_JPX:     $type = 'JPEG2000 photograph'; break;
+                                       case IMAGETYPE_JB2:     $type = 'Slowview document'; break;
+                                       case IMAGETYPE_SWC:     $type = 'Flash animation (compressed)'; break;
+                                       case IMAGETYPE_IFF:     $type = 'IFF document'; break;
+                                       case IMAGETYPE_WBMP:    $type = 'WBMP document'; break;
+                                       case IMAGETYPE_XBM:     $type = 'XBM document'; break;
+                                       default:                                $type = 'Unknown document'; break;
+                               }
+
+                               if ($size[2] == IMAGETYPE_GIF || $size[2] == IMAGETYPE_JPEG ||
+                                       $size[2] == IMAGETYPE_PNG)
+                               {
+                                       echo '<p><img src="' . sfFullUrl($directory . $file) . '" alt="" /></p>';
+                               }
+                               
+                               echo '<table>';
+                               echo '<tr><th colspan="2">' . _SKINFILES_VIEW_FILE_IMG_INFO . '</th></tr>';
+                               echo '<tr><td>' . _SKINFILES_VIEW_FILE_TYPE . '</td><td>' . htmlspecialchars($type) . '</td></tr>';
+                               echo '<tr><td>' . _SKINFILES_VIEW_FILE_WIDTH . '</td><td>' . htmlspecialchars($size[0]) . _SKINFILES_VIEW_FILE_PX . '</td></tr>';
+                               echo '<tr><td>' . _SKINFILES_VIEW_FILE_HEIGHT . '</td><td>' . htmlspecialchars($size[1]) . _SKINFILES_VIEW_FILE_PX . '</td></tr>';      
+                               
+                               if (isset($size['channels']) || isset($size['bits'])) 
+                               {
+                                       $channels = isset($size['channels']) ? $size['channels'] : 3;
+                                       $depth    = $size[2] == IMAGETYPE_GIF ? $size['bits'] : $size['bits'] * $channels;
+                                       echo '<tr><td>' . _SKINFILES_VIEW_FILE_CHANNELS . '</td><td>' . htmlspecialchars($channels) . '</td></tr>';
+                                       echo '<tr><td>' . _SKINFILES_VIEW_FILE_COLOR_DEPTH . '</td><td>' . htmlspecialchars($depth) . _SKINFILES_VIEW_FILE_BITS . '</td></tr>';
+                                       echo '<tr><td>' . _SKINFILES_VIEW_FILE_COLORS . '</td><td>' . htmlspecialchars(pow(2, $depth)) . _SKINFILES_VIEW_FILE_COLORS2 . '</td></tr>';
+                               }
+
+                               
+                               if (function_exists('exif_read_data') && ($size[2] == IMAGETYPE_JPEG || 
+                                       $size[2] == IMAGETYPE_TIFF_II || $size[2] == IMAGETYPE_TIFF_MM))
+                               {
+                                       $exif = exif_read_data($directory . $file, 'EXIF');
+                                       
+                                       if ($exif) 
+                                       {
+                                               echo '<tr><th colspan="2">Exif information</th></tr>';
+                                               
+                                               if (isset($exif['Make']) && isset($exif['Model']))
+                                                       echo '<tr><td>Camera:</td><td>' . htmlspecialchars($exif['Make'] . ' ' . $exif['Model']) . '</td></tr>';
+                                               
+                                               if (isset($exif['DateTime']))
+                                                       echo '<tr><td>Created on:</td><td>' . htmlspecialchars($exif['DateTime']) . '</td></tr>';
+                                               
+                                               if (isset($exif['XResolution']))
+                                                       echo '<tr><td>Horizontal resolution:</td><td>' . htmlspecialchars(_skinfiles_exif_prepare($exif['XResolution'])) . ' dpi</td></tr>';
+                                               
+                                               if (isset($exif['YResolution']))
+                                                       echo '<tr><td>Vertical resolution:</td><td>' . htmlspecialchars(_skinfiles_exif_prepare($exif['YResolution'])) . ' dpi</td></tr>';
+                                               
+                                               if (isset($exif['FocalLength']))
+                                                       echo '<tr><td>Focal length:</td><td>' . htmlspecialchars(_skinfiles_exif_prepare($exif['FocalLength'])) . ' mm</td></tr>';
+                                               
+                                               if (isset($exif['FNumber']))
+                                                       echo '<tr><td>F-number:</td><td>F/' . htmlspecialchars(_skinfiles_exif_prepare($exif['FNumber'])) . '</td></tr>';
+                                               
+                                               if (isset($exif['ExposureTime']))
+                                                       echo '<tr><td>Exposuretime:</td><td>' . htmlspecialchars(_skinfiles_exif_prepare($exif['ExposureTime'])) . ' sec</td></tr>';
+                                               
+                                               if (isset($exif['ISOSpeedRatings']))
+                                                       echo '<tr><td>ISO-speed:</td><td>' . htmlspecialchars(_skinfiles_exif_prepare($exif['ISOSpeedRatings'])) . '</td></tr>';
+                                       }
+                               }
+
+                               echo '</table>';
+                       }
+               }
+               else
+               {
+                       echo "<p class='error'>" . _SKINFILES_ERR_VIEW_FILE1 . "&laquo;" . htmlspecialchars($file) . "&raquo; " . _SKINFILES_ERR_VIEW_FILE2;
+                       echo _SKINFILES_ERR_VIEW_FILE3 . "</p>";
+               }
+       }
+
+       function _skinfiles_exif_prepare($value) {
+               if (preg_match('#([0-9]+)/([0-9]+)#', $value, $matches))
+                       if ($matches[1] < $matches[2])
+                               return '1/' . round($matches[2] / $matches[1]);
+                       else
+                               return round($matches[1] / $matches[2]);
+               else
+                       return $value;
+       }
+
+
+
+
+       /* Edit file *********************************************************************************************************************/
+
+       function _skinfiles_editfile() {
+
+               global $pluginUrl, $manager;
+               
+               $file      = basename(trim(requestVar('file')));
+               $directory = dirname(trim(requestVar('file')));
+               $directory = sfExpandDirectory ($directory);
+               
+               if (sfValidPath($directory) && file_exists($directory . $file) && 
+                       is_file($directory . $file) && is_writable($directory . $file) && sfAllowEditing($file)) 
+               {
+                       $relative = sfRelativePath ($directory);
+                       $editUrl  = $manager->addTicketToUrl($pluginUrl . '?action=editfile&file=' . rawurlencode(sfRelativePath($directory . $file)));
+
+                       echo '<p class="location">' . _SKINFILES_CURRENT_LOCATION . sfDisplayPath($relative);
+                       echo '<a href="' . htmlspecialchars($editUrl) . '" title="Edit &laquo;' . $file . '&raquo;">';
+                       echo '<img src="' . htmlspecialchars(sfIcon($file)) . '" alt="" /> ' . $file . '</a></p>';
+
+                       $content = implode('', file($directory . $file));
+
+                       echo '<div class="dialogbox">';
+                       echo '<form method="post" action="' . htmlspecialchars($pluginUrl) . '">';
+                       $manager->addTicketHidden();
+                       echo '<input type="hidden" name="action" value="editfile_process" />';
+                       echo '<input type="hidden" name="file" value="' . htmlspecialchars(sfRelativePath($directory . $file)) . '" />';
+
+                       echo '<h4>' . _SKINFILES_EDIT_FILE_MSG . ' &laquo;' . htmlspecialchars($file) . '&raquo;</h4><div>';
+                       echo '<p><textarea class="skinedit" tabindex="8" rows="20" cols="80" name="content">';
+                       echo htmlspecialchars($content);
+                       echo '</textarea></p>';
+                       
+                       echo '<p class="buttons">';
+                       echo '<input type="hidden" name="sure" value="yes" /">';
+                       echo '<input type="submit" value="' .  _SKINFILES_SAVE_CHANGES . '" />';
+                       echo '<input type="button" name="sure" value="' . _SKINFILES_CANCEL . '" onclick="history.back();" />';
+                       echo '</p>';
+                       echo '</div></form></div>';
+               }
+               else
+               {
+                       echo "<p class='error'>" . _SKINFILES_ERR_EDIT_FILE1 . "&laquo;" . htmlspecialchars($file) . "&raquo; " . _SKINFILES_ERR_EDIT_FILE2;
+                       echo _SKINFILES_ERR_EDIT_FILE3 . "</p>";
+               }
+       }
+
+       function _skinfiles_editfile_process() {
+
+               $file      = basename(trim(requestVar('file')));
+               $directory = dirname(trim(requestVar('file')));
+               $directory = sfExpandDirectory ($directory);
+               
+               if (requestVar('sure') == 'yes')
+               {
+                       if (sfValidPath($directory) && file_exists($directory . $file) && 
+                               is_file($directory . $file) && is_writable($directory . $file) && sfAllowEditing($file)) 
+                       {
+                               $content = postVar('content');
+                               $success = false;
+                               
+                               if ($fh = @fopen($directory . $file, 'wb')) { 
+                                       
+                                       if (@fwrite($fh, $content) !== false)
+                                               $success = true;
+                                               
+                                       @fclose($fh);
+                               }
+                               
+                               if ($success)
+                                       echo "<p class='message'>" . _SKINFILES_ERR_EDIT_FILE4 . "&laquo;" . htmlspecialchars($file) . "&raquo; " . _SKINFILES_ERR_EDIT_FILE5 . "</p>";
+                               else
+                                       echo "<p class='error'>" . _SKINFILES_ERR_EDIT_FILE6 . "&laquo;" . htmlspecialchars($file) . "&raquo; " . _SKINFILES_ERR_EDIT_FILE7 . "</p>";
+                       
+                               _skinfiles_editfile();
+                       }
+                       else
+                       {
+                               echo "<p class='error'>" . _SKINFILES_ERR_EDIT_FILE1 . "&laquo;" . htmlspecialchars($file) . "&raquo; " . _SKINFILES_ERR_EDIT_FILE2;
+                               echo _SKINFILES_ERR_EDIT_FILE3 . "</p>";
+                       }
+               }
+               else
+               {
+                       // User cancelled
+                       sfShowDirectory($directory);
+               }
+       }
+
+
+
+       /* Rename file *******************************************************************************************************************/
+
+       function _skinfiles_renfile($preset = '') {
+
+               global $pluginUrl, $manager;
+               
+               $file      = basename(trim(requestVar('file')));
+               $directory = dirname(trim(requestVar('file')));
+               $directory = sfExpandDirectory ($directory);
+               
+               if (sfValidPath($directory) && file_exists($directory . $file) && 
+                       is_file($directory . $file) && is_writable($directory . $file)) 
+               {
+                       $relative = sfRelativePath ($directory);
+                       $editUrl  = $manager->addTicketToUrl($pluginUrl . '?action=renfile&file=' . rawurlencode(sfRelativePath($directory . $file)));
+
+                       echo '<p class="location">' . _SKINFILES_CURRENT_LOCATION . sfDisplayPath($relative);
+                       echo '<a href="' . htmlspecialchars($editUrl) . '" title="' . _SKINFILES_RENAME . ' &laquo;' . $file . '&raquo;">';
+                       echo '<img src="' . htmlspecialchars(sfIcon($file)) . '" alt="" /> ' . $file . '</a></p>';
+
+                       echo '<div class="dialogbox">';
+                       echo '<form method="post" action="' . htmlspecialchars($pluginUrl) . '">';
+                       $manager->addTicketHidden();
+                       echo '<input type="hidden" name="action" value="renfile_process" />';
+                       echo '<input type="hidden" name="file" value="' . htmlspecialchars(sfRelativePath($directory . $file)) . '" />';
+
+                       echo '<h4>' . _SKINFILES_RENAME_FILE_MSG . '&laquo;' . htmlspecialchars($file) . '&raquo; ' . _SKINFILES_RENAME_FILE_MSG2 . '</h4><div>';
+                       echo '<p><input type="text" name="name" size="40" value="' . htmlspecialchars($preset != '' ? $preset : $file) . '" /></p>';
+                       echo '<p class="buttons">';
+                       echo '<input type="hidden" name="sure" value="yes" /">';
+                       echo '<input type="submit" value="' . _SKINFILES_RENAME . '" />';
+                       echo '<input type="button" name="sure" value="' . _SKINFILES_CANCEL . '" onclick="history.back();" />';
+                       echo '</p>';
+                       echo '</div></form></div>';
+               }
+               else
+               {
+                       echo "<p class='error'>" . _SKINFILES_ERR_RENAME_FILE1 . "&laquo;" . htmlspecialchars($file) . "&raquo; " . _SKINFILES_ERR_RENAME_FILE2;
+                       echo _SKINFILES_ERR_RENAME_FILE3 . "</p>";
+               }
+       }
+       
+       function _skinfiles_renfile_process() {
+
+               global $pluginUrl, $manager;
+               
+               $file      = basename(trim(requestVar('file')));
+               $directory = dirname(trim(requestVar('file')));
+               $directory = sfExpandDirectory ($directory);
+               
+               if (requestVar('sure') == 'yes')
+               {
+                       if (sfValidPath($directory) && file_exists($directory . $file) && 
+                               is_file($directory . $file) && is_writable($directory . $file)) 
+                       {
+                               $name = requestVar('name');
+
+                               if ($name == '') {
+                                       echo "<p class='error'>" . _SKINFILES_ERR_RENAME_FILE4 . "&laquo;" . htmlspecialchars($file) . "&raquo; ";
+                                       echo _SKINFILES_ERR_RENAME_FILE5 . "</p>";
+                                       _skinfiles_renfile($name);
+                                       return;
+                               }
+                               
+                               if (sfIllegalFilename($name)) {
+                                       echo "<p class='error'>" . _SKINFILES_ERR_RENAME_FILE6 . "&laquo;" . htmlspecialchars($file) . "&raquo; ";
+                                       echo _SKINFILES_ERR_RENAME_FILE7 . "</p>";
+                                       _skinfiles_renfile($name);
+                                       return;
+                               } 
+                               
+                               if ($name == $file) {
+                                       echo "<p class='error'>" . _SKINFILES_ERR_RENAME_FILE8 . "&laquo;" . htmlspecialchars($file) . "&raquo; ";
+                                       echo _SKINFILES_ERR_RENAME_FILE9 . "</p>";
+                                       _skinfiles_renfile($name);
+                                       return;
+                               }
+                               
+                               if (file_exists($directory . $name)) {
+                                       echo "<p class='error'>" . _SKINFILES_ERR_RENAME_FILE10 . "&laquo;" . htmlspecialchars($file) . "&raquo; ";
+                                       echo _SKINFILES_ERR_RENAME_FILE11;
+                                       echo _SKINFILES_ERR_RENAME_FILE12 . "</p>";
+                                       _skinfiles_renfile($name);
+                                       return;
+                               }
+
+                               if (!@rename($directory . $file, $directory . $name)) 
+                               {
+                                       echo "<p class='error'>" . _SKINFILES_ERR_RENAME_FILE13 . "&laquo;" . htmlspecialchars($file) . "&raquo; " . _SKINFILES_ERR_RENAME_FILE14 . "</p>";
+                                       _skinfiles_renfile($name);
+                                       return;
+                               }
+       
+                               echo "<p class='message'>" . _SKINFILES_ERR_RENAME_FILE15 . "&laquo;" . htmlspecialchars($file) . "&raquo; " . _SKINFILES_ERR_RENAME_FILE16;
+                               echo _SKINFILES_ERR_RENAME_FILE17 . "&laquo;" . htmlspecialchars($name) . "&raquo;" . _SKINFILES_ERR_RENAME_FILE18 . "</p>";
+                               sfShowDirectory($directory);
+                       }               
+                       else
+                       {
+                               echo "<p class='error'>" . _SKINFILES_ERR_RENAME_FILE1 . "&laquo;" . htmlspecialchars($file) . "&raquo; " . _SKINFILES_ERR_RENAME_FILE2;
+                               echo _SKINFILES_ERR_RENAME_FILE3 . "</p>";
+                       }
+               }
+               else
+               {
+                       // User cancelled
+                       sfShowDirectory($directory);
+               }
+       }
+
+
+
+
+       /* Create file *******************************************************************************************************************/
+
+       function _skinfiles_createfile() {
+       
+               $directory = trim(requestVar('dir'));
+               $directory = sfExpandDirectory($directory);
+
+               if (sfValidPath($directory) && is_dir($directory) && is_writable($directory)) 
+               {
+                       $name = requestVar('name');
+                       
+                       if ($name == '') {
+                               echo "<p class='error'>" . _SKINFILES_ERR_CREATE_FILE1 . "</p>";
+                               sfShowDirectory($directory);
+                               return;
+                       }
+                       
+                       if (sfIllegalFilename($name)) {
+                               echo "<p class='error'>" . _SKINFILES_ERR_CREATE_FILE2 . "&laquo;" . htmlspecialchars($name) . "&raquo; ";
+                               echo _SKINFILES_ERR_CREATE_FILE3 . "</p>";
+                               sfShowDirectory($directory);
+                               return;
+                       } 
+                       
+                       if (file_exists($directory . $name)) {
+                               echo "<p class='error'>" . _SKINFILES_ERR_CREATE_FILE4 . "&laquo;" . htmlspecialchars($name) . "&raquo; ";
+                               echo _SKINFILES_ERR_CREATE_FILE5;
+                               echo _SKINFILES_ERR_CREATE_FILE6 . "</p>";
+                               sfShowDirectory($directory);
+                               return;
+                       }
+                       
+                       if (!@touch($directory . $name)) 
+                       {
+                               echo "<p class='error'>" . _SKINFILES_ERR_CREATE_FILE7 . "&laquo;" . htmlspecialchars($name) . "&raquo; " . _SKINFILES_ERR_CREATE_FILE8 . "</p>";
+                               sfShowDirectory($directory);
+                               return;
+                       }
+
+                       $mask = @umask(0000);
+                       @chmod($directory . $name, 0755);
+                       @umask($mask);
+                       
+                       echo "<p class='message'>" . _SKINFILES_ERR_CREATE_FILE9 . "&laquo;" . htmlspecialchars($name) . "&raquo; " . _SKINFILES_ERR_CREATE_FILE10 . "</p>";
+                       sfShowDirectory($directory);
+               }               
+               else
+               {
+                       echo "<p class='error'>" . _SKINFILES_ERR_CREATE_FILE11 . "&laquo;" . htmlspecialchars(basename($directory)) . "&raquo; " . _SKINFILES_ERR_CREATE_FILE12;
+                       echo _SKINFILES_ERR_CREATE_FILE13 . "</p>";
+               }
+       }
+
+
+
+
+       /* Delete file *******************************************************************************************************************/
+
+       function _skinfiles_delfile() {
+
+               global $pluginUrl, $manager;
+               
+               $file      = basename(trim(requestVar('file')));
+               $directory = dirname(trim(requestVar('file')));
+               $directory = sfExpandDirectory ($directory);
+               
+               if (sfValidPath($directory) && file_exists($directory . $file) && 
+                       is_file($directory . $file) && is_writable($directory . $file)) 
+               {
+                       $relative = sfRelativePath ($directory);
+                       $delUrl  = $manager->addTicketToUrl($pluginUrl . '?action=delfile&file=' . rawurlencode(sfRelativePath($directory . $file)));
+
+                       echo '<p class="location">' . _SKINFILES_CURRENT_LOCATION . sfDisplayPath($relative);
+                       echo '<a href="' . htmlspecialchars($delUrl) . '" title="' . _SKINFILES_DELETE . ' &laquo;' . $file . '&raquo;">';
+                       echo '<img src="' . htmlspecialchars(sfIcon($file)) . '" alt="" /> ' . $file . '</a></p>';
+
+                       echo '<div class="dialogbox">';
+                       echo '<form method="post" action="' . htmlspecialchars($pluginUrl) . '">';
+                       $manager->addTicketHidden();
+                       echo '<input type="hidden" name="action" value="delfile_process" />';
+                       echo '<input type="hidden" name="file" value="' . htmlspecialchars(sfRelativePath($directory . $file)) . '" />';
+
+                       echo '<h4>' . _SKINFILES_DELETE_FILE . ' &laquo;' . htmlspecialchars($file) . '&raquo; ' . _SKINFILES_DELETE_FILE2 . '</h4><div>';
+                       echo '<p class="buttons">';
+                       echo '<input type="hidden" name="sure" value="yes" />';
+                       echo '<input type="submit" value="' . _SKINFILES_DELETE . '" />';
+                       echo '<input type="button" name="sure" value="' . _SKINFILES_CANCEL . '" onclick="history.back();" />';
+                       echo '</p>';
+                       echo '</div></form></div>';
+               }
+               else
+               {
+                       echo "<p class='error'>"  . _SKINFILES_ERR_DELETE_FILE1 . "&laquo;" . htmlspecialchars($file) . "&raquo; " . _SKINFILES_ERR_DELETE_FILE2;
+                       echo _SKINFILES_ERR_DELETE_FILE3 . "</p>";
+               }
+       }
+
+       function _skinfiles_delfile_process() {
+
+               global $pluginUrl, $manager;
+               
+               $file      = basename(trim(requestVar('file')));
+               $directory = dirname(trim(requestVar('file')));
+               $directory = sfExpandDirectory ($directory);
+               
+               if (requestVar('sure') == 'yes')
+               {
+                       if (sfValidPath($directory) && file_exists($directory . $file) && 
+                               is_file($directory . $file) && is_writable($directory . $file)) 
+                       {
+                               if (!@unlink($directory . $file)) 
+                               {
+                                       echo "<p class='error'>" . _SKINFILES_ERR_DELETE_FILE4 . "&laquo;" . htmlspecialchars($file) . "&raquo;</p>";
+                                       sfShowDirectory($directory);
+                                       return;
+                               }
+       
+                               echo "<p class='message'>" . _SKINFILES_ERR_DELETE_FILE5 . "&laquo;" . htmlspecialchars($file) . "&raquo; " . _SKINFILES_ERR_DELETE_FILE6 . "</p>";
+                               sfShowDirectory($directory);
+                       }               
+                       else
+                       {
+                               echo "<p class='error'>" . _SKINFILES_ERR_DELETE_FILE1 . "&laquo;" . htmlspecialchars($file) . "&raquo; " . _SKINFILES_ERR_DELETE_FILE2;
+                               echo _SKINFILES_ERR_DELETE_FILE3 . "</p>";
+                       }
+               }
+               else
+               {
+                       // User cancelled
+                       sfShowDirectory($directory);
+               }
+       }
+
+
+
+       /* Upload file *******************************************************************************************************************/
+
+       function _skinfiles_uploadfile() {
+
+               global $pluginUrl, $manager, $CONF;
+               
+               $directory = trim(requestVar('dir'));
+               $directory = sfExpandDirectory($directory);
+
+               if (sfValidPath($directory) && is_dir($directory) && is_writable($directory)) 
+               {
+                       $file = postFileInfo('name');
+
+                       if ($file['size'] > $CONF['MaxUploadSize']) {
+                               echo "<p class='error'>" . _SKINFILES_ERR_UPLOAD_FILE1 . "&laquo;" . htmlspecialchars($file['name']) . "&raquo; " . _SKINFILES_ERR_UPLOAD_FILE2 . _ERROR_FILE_TOO_BIG . "<br />";
+                               echo _SKINFILES_ERR_UPLOAD_FILE3 . $CONF['MaxUploadSize'] . " / ";
+                               echo $file['size'] . " bytes</p>";
+                               sfShowDirectory($directory);
+                               return;
+                       }
+
+                       if (!is_uploaded_file($file['tmp_name'])) {
+                               echo "<p class='error'>" . _SKINFILES_ERR_UPLOAD_FILE1 . "&laquo;" . htmlspecialchars($file['name']) . "&raquo; " . _SKINFILES_ERR_UPLOAD_FILE2 . _ERROR_BADREQUEST .  _SKINFILES_ERR_UPLOAD_FILE4 . "</p>";
+                               sfShowDirectory($directory);
+                               return;
+                       }
+                       
+                       if (sfIllegalFilename($file['name'])) {
+                               echo "<p class='error'>" . _SKINFILES_ERR_UPLOAD_FILE5 . "&laquo;" . htmlspecialchars($file['name']) . "&raquo; ";
+                               echo _SKINFILES_ERR_UPLOAD_FILE6 . "</p>";
+                               sfShowDirectory($directory);
+                               return;
+                       }
+                       
+                       if (file_exists($directory . $file['name'])) {
+                               echo "<p class='error'>" . _SKINFILES_ERR_UPLOAD_FILE1 . "&laquo;" . htmlspecialchars($file['name']) . "&raquo; " . _SKINFILES_ERR_UPLOAD_FILE2 . _ERROR_UPLOADDUPLICATE . "</p>";
+                               sfShowDirectory($directory);
+                               return;
+                       }
+
+                       if (!@move_uploaded_file($file['tmp_name'], $directory . $file['name'])) {
+                               echo "<p class='error'>" . _SKINFILES_ERR_UPLOAD_FILE1 . "&laquo;" . htmlspecialchars($file['name']) . "&raquo; " . _SKINFILES_ERR_UPLOAD_FILE2 . _ERROR_UPLOADMOVEP . _SKINFILES_ERR_UPLOAD_FILE4 . "</p>";
+                               sfShowDirectory($directory);
+                       }
+
+                       $mask = @umask(0000);
+                       @chmod($directory . $file['name'], 0755);
+                       @umask($mask);
+
+                       echo "<p class='message'>" . _SKINFILES_ERR_UPLOAD_FILE7 . "&laquo;" . htmlspecialchars($file['name']) . "&raquo; " . _SKINFILES_ERR_UPLOAD_FILE8 . "</p>";
+                       sfShowDirectory($directory);
+               }
+               else
+               {
+                       echo "<p class='error'>" . _SKINFILES_ERR_UPLOAD_FILE9 . "&laquo;" . htmlspecialchars(basename($directory)) . "&raquo; " . _SKINFILES_ERR_UPLOAD_FILE10;
+                       echo _SKINFILES_ERR_UPLOAD_FILE11 . "</p>";
+               }       
+       }
+
+
+
+
+       
+?>
diff --git a/euc/nucleus/plugins/skinfiles/japanese-euc.php b/euc/nucleus/plugins/skinfiles/japanese-euc.php
new file mode 100644 (file)
index 0000000..8ee279c
--- /dev/null
@@ -0,0 +1,178 @@
+<?php
+
+   /*
+       * @version $Id: japanese-euc.php,v 1.2 2007-03-22 09:16:11 kimitake Exp $
+       * @version $NucleusJP: japanese-euc.php,v 1.3 2007/02/04 06:28:46 kimitake Exp $
+       */
+
+define('_SKINFILES_TITLE',                             '¥¹¥­¥ó¥Õ¥¡¥¤¥ë');
+define('_SKINFILES_TOOLTIP',                   '¥¹¥­¥ó¥Õ¥¡¥¤¥ë¤Î´ÉÍý');
+
+define('_SKINFILES_MANAGEMENT',                        '¥¹¥­¥ó¥Õ¥¡¥¤¥ë´ÉÍý');
+define('_SKINFILES_CURRENT_LOCATION',  '¸½ºß¤Î¥Ç¥£¥ì¥¯¥È¥ê: ');
+define('_SKINFILES_NAME',                              '̾Á°');
+define('_SKINFILES_SIZE',                              '¥µ¥¤¥º');
+define('_SKINFILES_LAST_MODIFIED',             'ºÇ½ª¹¹¿·Æü');
+define('_SKINFILES_ACTIONS',                   '¥¢¥¯¥·¥ç¥ó');
+
+define('_SKINFILES_RENAME',                            '̾Á°Êѹ¹');
+define('_SKINFILES_RENAME_DIR_MSG',            '¤³¤Î¥Ç¥£¥ì¥¯¥È¥ê̾');
+define('_SKINFILES_RENAME_DIR_MSG2',   '¤ò²¼µ­¤Î̾Á°¤ËÊѹ¹');
+define('_SKINFILES_EDIT_FILE_MSG',             '¥Õ¥¡¥¤¥ë¤ÎÊÔ½¸');
+define('_SKINFILES_RENAME_FILE_MSG',   '¥Õ¥¡¥¤¥ë');
+define('_SKINFILES_RENAME_FILE_MSG2',  '¤Î̾Á°¤ò²¼µ­¤ËÊѹ¹:');
+define('_SKINFILES_DELETE',                            'ºï½ü');
+define('_SKINFILES_EDIT',                              'ÊÔ½¸');
+define('_SKINFILES_CANCEL',                            '¥­¥ã¥ó¥»¥ë');
+define('_SKINFILES_DOWNLOAD',                  '¥À¥¦¥ó¥í¡¼¥É');
+define('_SKINFILES_SAVE_CHANGES',              'Êݸ');
+
+define('_SKINFILES_DATE_FORMAT',               'Y/m/d H:i');
+
+define('_SKINFILES_CREATE_NEW_FILE',   '¿·µ¬¥Õ¥¡¥¤¥ë¤ÎºîÀ®');
+define('_SKINFILES_CREATE_NEW_DIR',            '¿·µ¬¥Ç¥£¥ì¥¯¥È¥ê¤ÎºîÀ®');
+define('_SKINFILES_CREATE_FILE',               '¥Õ¥¡¥¤¥ëºîÀ®');
+define('_SKINFILES_CREATE',                            'ºîÀ®');
+define('_SKINFILES_UPLOAD',                            '¥¢¥Ã¥×¥í¡¼¥É');
+define('_SKINFILES_DELETE_FILE',               '¥Õ¥¡¥¤¥ë');
+define('_SKINFILES_DELETE_FILE2',              ' ¤òºï½ü¤·¤Þ¤¹¤«¡©');
+define('_SKINFILES_DELETE_DIR',                        '¥Ç¥£¥ì¥¯¥È¥ê');
+define('_SKINFILES_DELETE_DIR2',               ' ¤òºï½ü¤·¤Þ¤¹¤«¡©');
+define('_SKINFILES_DELETE_ALL',                        'Á´ºï½ü');
+define('_SKINFILES_DELETE_FILE_MSG',   '¥Ç¥£¥ì¥¯¥È¥ê');
+define('_SKINFILES_DELETE_FILE_MSG2',  ' ¤«¤é²¼µ­¤Î¥Õ¥¡¥¤¥ë¤òºï½ü¤·¤Þ¤¹¤«¡©');
+define('_SKINFILES_UPLOAD_NEW_FILE',   '¿·µ¬¥Õ¥¡¥¤¥ë¤Î¥¢¥Ã¥×¥í¡¼¥É');
+define('_SKINFILES_DEL_ALL_FILES',             '¸½¥Ç¥£¥ì¥¯¥È¥ê¤ÎÁ´¥Õ¥¡¥¤¥ëºï½ü');
+define('_SKINFILES_DEL_ALL_FILES_MSG', 'Á´¥Õ¥¡¥¤¥ë¤òºï½ü¤·¤Þ¤¹¤«¡© ¡ÊºÇ½ª³Îǧ¤¢¤ê¡Ë');
+
+define('_SKINFILES_VIEW_FILE',                         '¥Õ¥¡¥¤¥ëɽ¼¨ ');
+define('_SKINFILES_VIEW_FILE_IMG_INFO',                '¥¤¥á¡¼¥¸¾ðÊó');
+define('_SKINFILES_VIEW_FILE_TYPE',                    '¼ïÊÌ');
+define('_SKINFILES_VIEW_FILE_WIDTH',           '²£¥µ¥¤¥º');
+define('_SKINFILES_VIEW_FILE_HEIGHT',          '½Ä¥µ¥¤¥º');
+define('_SKINFILES_VIEW_FILE_PX',                      ' ¥Ô¥¯¥»¥ë');
+define('_SKINFILES_VIEW_FILE_CHANNELS',                '¥Á¥ã¥ó¥Í¥ë¿ô');
+define('_SKINFILES_VIEW_FILE_COLOR_DEPTH',     '¿§¿¼ÅÙ');
+define('_SKINFILES_VIEW_FILE_BITS',                    ' ¥Ó¥Ã¥È');
+define('_SKINFILES_VIEW_FILE_COLORS',          '¿§¿ô');
+define('_SKINFILES_VIEW_FILE_COLORS2',         ' ¿§');
+
+
+define('_SKINFILES_ERR_DIR_DOES_NOT_CONTAIN',  '¤³¤Î¥Ç¥£¥ì¥¯¥È¥ê¤Ë¤Ï¥Õ¥¡¥¤¥ë¡¦¥Ç¥£¥ì¥¯¥È¥ê¤¬Â¸ºß¤·¤Þ¤»¤ó¡£');
+define('_SKINFILES_ERR_DIR_DOES_NOT_EXIST1',   '¥¨¥é¡¼: ¥Ç¥£¥ì¥¯¥È¥ê ');
+define('_SKINFILES_ERR_DIR_DOES_NOT_EXIST2',   '¤Ï¸ºß¤·¤Ê¤¤¤«¡¢');
+define('_SKINFILES_ERR_DIR_DOES_NOT_EXIST3',   '¤½¤Î¥Ç¥£¥ì¥¯¥È¥ê̾¤òÊѹ¹¤¹¤ë¸¢¸Â¤¬¤¢¤ê¤Þ¤»¤ó¡£');
+
+define('_SKINFILES_ERR_COULD_NOT_RENAME_DIR1', '¥¨¥é¡¼: ¿·¤·¤¤Ì¾Á°¤¬ÀßÄꤵ¤ì¤Þ¤»¤ó¤Ç¤·¤¿¤Î¤Ç ');
+define('_SKINFILES_ERR_COULD_NOT_RENAME_DIR2', '¤ÏÊѹ¹¤Ç¤­¤Þ¤»¤ó¤Ç¤·¤¿¡£');
+define('_SKINFILES_ERR_COULD_NOT_RENAME_DIR3', '¥¨¥é¡¼: ÀßÄꤷ¤¿Ì¾Á°¤Ë£±¤Ä°Ê¾å¤Î̵¸ú¤Êʸ»ú¤¬´Þ¤Þ¤ì¤Æ¤¤¤Þ¤·¤¿¤Î¤Ç ');
+define('_SKINFILES_ERR_COULD_NOT_RENAME_DIR4', '¤ÏÊѹ¹¤Ç¤­¤Þ¤»¤ó¤Ç¤·¤¿¡£');
+define('_SKINFILES_ERR_COULD_NOT_RENAME_DIR5', '¥¨¥é¡¼: ÀßÄꤷ¤¿Ì¾Á°¤Ï¸µ¤Î̾Á°¤ÈƱ¤¸¤Ç¤·¤¿¤Î¤Ç ');
+define('_SKINFILES_ERR_COULD_NOT_RENAME_DIR6', '¤ÏÊѹ¹¤Ç¤­¤Þ¤»¤ó¤Ç¤·¤¿¡£');
+define('_SKINFILES_ERR_COULD_NOT_RENAME_DIR7', 'Ê̤Î̾Á°¤òÀßÄꤷ¤Æ²¼¤µ¤¤¡£');
+define('_SKINFILES_ERR_COULD_NOT_RENAME_DIR8', '¥¨¥é¡¼: ÀßÄꤷ¤¿Ì¾Á°¤Ï´û¤Ë¾¤Î¥Õ¥¡¥¤¥ë¤ä¥Ç¥£¥ì¥¯¥È¥ê¤Ë»ÈÍѤµ¤ì¤Æ¤¤¤Þ¤·¤¿¤Î¤Ç ');
+define('_SKINFILES_ERR_COULD_NOT_RENAME_DIR9', '¤ÏÊѹ¹¤Ç¤­¤Þ¤»¤ó¤Ç¤·¤¿¡£');
+define('_SKINFILES_ERR_COULD_NOT_RENAME_DIR10',        'Ê̤Î̾Á°¤ò»ÈÍѤ¹¤ë¤«¡¢¤Þ¤º´û¸¤Î¥Õ¥¡¥¤¥ë¤Þ¤¿¤Ï¥Ç¥£¥ì¥¯¥È¥ê¤òºï½ü¤·¤Æ²¼¤µ¤¤¡£');
+define('_SKINFILES_ERR_COULD_NOT_RENAME_DIR11',        '¥¨¥é¡¼: ¼¡¤Î¥Ç¥£¥ì¥¯¥È¥ê̾¤òÊѹ¹¤Ç¤­¤Þ¤»¤ó¤Ç¤·¤¿¡£ ');
+
+define('_SKINFILES_RENAMED_DIR1',                              '¥á¥Ã¥»¡¼¥¸: ¥Ç¥£¥ì¥¯¥È¥ê ');
+define('_SKINFILES_RENAMED_DIR2',                              '¤Î̾Á°¤ò ');
+define('_SKINFILES_RENAMED_DIR3',                              '');
+define('_SKINFILES_RENAMED_DIR4',                              ' ¤ËÊѹ¹¤·¤Þ¤·¤¿¡£');
+
+define('_SKINFILES_ERR_COULD_NOT_CREATE_DIR1', '¥¨¥é¡¼: Ì¾Á°¤¬ÀßÄꤵ¤ì¤Þ¤»¤ó¤Ç¤·¤¿¤Î¤Ç¡¢¿·µ¬¤Ë¥Ç¥£¥ì¥¯¥È¥ê¤òºîÀ®¤Ç¤­¤Þ¤»¤ó¤Ç¤·¤¿¡£ ');
+define('_SKINFILES_ERR_COULD_NOT_CREATE_DIR2', '¥¨¥é¡¼: ÀßÄꤷ¤¿Ì¾Á°¤Ë£±¤Ä°Ê¾å¤Î̵¸ú¤Êʸ»ú¤¬´Þ¤Þ¤ì¤Æ¤¤¤Þ¤·¤¿¤Î¤Ç ');
+define('_SKINFILES_ERR_COULD_NOT_CREATE_DIR3', '¿·µ¬¤Ë¥Ç¥£¥ì¥¯¥È¥ê¤òºîÀ®¤Ç¤­¤Þ¤»¤ó¤Ç¤·¤¿¡£');
+define('_SKINFILES_ERR_COULD_NOT_CREATE_DIR4', '¥¨¥é¡¼: ÀßÄꤷ¤¿Ì¾Á°¤Ï´û¤Ë¾¤Î¥Õ¥¡¥¤¥ë¤Þ¤¿¤Ï¥Ç¥£¥ì¥¯¥È¥ê¤Ë»ÈÍѤµ¤ì¤Æ¤¤¤Þ¤·¤¿¤Î¤Ç ');
+define('_SKINFILES_ERR_COULD_NOT_CREATE_DIR5', ' ¤Î¥Ç¥£¥ì¥¯¥È¥ê¤ò¿·µ¬¤ÇºîÀ®¤Ç¤­¤Þ¤»¤ó¤Ç¤·¤¿¡£');
+define('_SKINFILES_ERR_COULD_NOT_CREATE_DIR6', 'Ê̤Î̾Á°¤ò»ÈÍѤ¹¤ë¤«¡¢¤Þ¤º´û¸¤Î¥Õ¥¡¥¤¥ë¤Þ¤¿¤Ï¥Ç¥£¥ì¥¯¥È¥ê¤òºï½ü¤·¤Æ²¼¤µ¤¤¡£');
+define('_SKINFILES_ERR_COULD_NOT_CREATE_DIR7', '¥á¥Ã¥»¡¼¥¸: ¥Ç¥£¥ì¥¯¥È¥ê ');
+define('_SKINFILES_ERR_COULD_NOT_CREATE_DIR8', '¤òºîÀ®¤·¤Þ¤·¤¿¡£');
+define('_SKINFILES_ERR_COULD_NOT_CREATE_DIR9', '¥¨¥é¡¼: ¥Ç¥£¥ì¥¯¥È¥ê ');
+define('_SKINFILES_ERR_COULD_NOT_CREATE_DIR10',        '¤Ï¸ºß¤·¤Ê¤¤¤«');
+define('_SKINFILES_ERR_COULD_NOT_CREATE_DIR11',        '¤½¤Î¥Ç¥£¥ì¥¯¥È¥ê¤Ë¥¢¥¯¥»¥¹¤¹¤ë¸¢¸Â¤¬¤¢¤ê¤Þ¤»¤ó¡£');
+
+define('_SKINFILES_ERR_DELETE_DIR1',                   '¥¨¥é¡¼: ¥Ç¥£¥ì¥¯¥È¥ê ');
+define('_SKINFILES_ERR_DELETE_DIR2',                   '¤Ï¸ºß¤·¤Ê¤¤¤«');
+define('_SKINFILES_ERR_DELETE_DIR3',                   '¤½¤Î¥Ç¥£¥ì¥¯¥È¥ê¤òºï½ü¤¹¤ë¸¢¸Â¤¬¤¢¤ê¤Þ¤»¤ó¡£');
+define('_SKINFILES_ERR_DELETE_DIR4',                   '¥¨¥é¡¼: ¥Ç¥£¥ì¥¯¥È¥ê¤òºï½ü¤Ç¤­¤Þ¤»¤ó¤Ç¤·¤¿¡£');
+define('_SKINFILES_ERR_DELETE_DIR5',                   '¥á¥Ã¥»¡¼¥¸: ¥Ç¥£¥ì¥¯¥È¥ê ');
+define('_SKINFILES_ERR_DELETE_DIR6',                   '¤òºï½ü¤·¤Þ¤·¤¿¡£');
+define('_SKINFILES_ERR_DELETE_DIR7',                   '¸½ºß¤³¤Î¥Ç¥£¥ì¥¯¥È¥ê¤Ë¤Ïºï½ü¤Ç¤­¤ë¥Õ¥¡¥¤¥ë¤Ï¤¢¤ê¤Þ¤»¤ó¡£');
+
+define('_SKINFILES_ERR_EMPTY_DIR1',                            '¥á¥Ã¥»¡¼¥¸: ¥Õ¥¡¥¤¥ë ');
+define('_SKINFILES_ERR_EMPTY_DIR2',                            '¤òºï½ü¤·¤Þ¤·¤¿¡£');
+define('_SKINFILES_ERR_EMPTY_DIR3',                            '¥¨¥é¡¼: ¥Õ¥¡¥¤¥ë ');
+define('_SKINFILES_ERR_EMPTY_DIR4',                            '¤Ïºï½ü¤Ç¤­¤Þ¤»¤ó¤Ç¤·¤¿¡£');
+define('_SKINFILES_ERR_EMPTY_DIR5',                            '¥¨¥é¡¼: ¥Ç¥£¥ì¥¯¥È¥ê ');
+define('_SKINFILES_ERR_EMPTY_DIR6',                            '¤Ï¸ºß¤·¤Ê¤¤¤«');
+define('_SKINFILES_ERR_EMPTY_DIR7',                            '¤½¤Î¥Ç¥£¥ì¥¯¥È¥ê¤Ë¥¢¥¯¥»¥¹¤¹¤ë¸¢¸Â¤¬¤¢¤ê¤Þ¤»¤ó¡£');
+
+define('_SKINFILES_ERR_DOWNLOAD_FILE1',                        '¥¨¥é¡¼: ¥Õ¥¡¥¤¥ë¤Ë¥¢¥¯¥»¥¹¤Ç¤­¤Þ¤»¤ó¤Ç¤·¤¿¡£');
+define('_SKINFILES_ERR_DOWNLOAD_FILE2',                        '¥¨¥é¡¼: ¤½¤Î¥Õ¥¡¥¤¥ë¤Ë¥¢¥¯¥»¥¹¤¹¤ë¸¢¸Â¤¬¤¢¤ê¤Þ¤»¤ó¤Ç¤·¤¿¡£');
+
+define('_SKINFILES_ERR_VIEW_FILE1',                            '¥¨¥é¡¼: ¥Õ¥¡¥¤¥ë ');
+define('_SKINFILES_ERR_VIEW_FILE2',                            '¤Ï¸ºß¤·¤Ê¤¤¤«');
+define('_SKINFILES_ERR_VIEW_FILE3',                            '¤½¤Î¥Õ¥¡¥¤¥ë¤ò»²¾È¤¹¤ë¸¢¸Â¤¬¤¢¤ê¤Þ¤»¤ó¡£');
+
+define('_SKINFILES_ERR_EDIT_FILE1',                            '¥¨¥é¡¼: ¥Õ¥¡¥¤¥ë ');
+define('_SKINFILES_ERR_EDIT_FILE2',                            '¤Ï¸ºß¤·¤Ê¤¤¤«');
+define('_SKINFILES_ERR_EDIT_FILE3',                            '¤½¤Î¥Õ¥¡¥¤¥ë¤òÊÔ½¸¤¹¤ë¸¢¸Â¤¬¤¢¤ê¤Þ¤»¤ó¡£');
+define('_SKINFILES_ERR_EDIT_FILE4',                            '¥á¥Ã¥»¡¼¥¸: ¥Õ¥¡¥¤¥ë ');
+define('_SKINFILES_ERR_EDIT_FILE5',                            '¤òÊݸ¤·¤Þ¤·¤¿¡£');
+define('_SKINFILES_ERR_EDIT_FILE6',                            '¥¨¥é¡¼: ¥Õ¥¡¥¤¥ë ');
+define('_SKINFILES_ERR_EDIT_FILE7',                            '¤ÏÊݸ¤Ç¤­¤Þ¤»¤ó¤Ç¤·¤¿¡£');
+
+define('_SKINFILES_ERR_RENAME_FILE1',                  '¥¨¥é¡¼: ¥Õ¥¡¥¤¥ë ');
+define('_SKINFILES_ERR_RENAME_FILE2',                  '¤Ï¸ºß¤·¤Ê¤¤¤«');
+define('_SKINFILES_ERR_RENAME_FILE3',                  '¤½¤Î¥Õ¥¡¥¤¥ë̾¤òÊѹ¹¤¹¤ë¸¢¸Â¤¬¤¢¤ê¤Þ¤»¤ó¡£');
+define('_SKINFILES_ERR_RENAME_FILE4',                  '¥¨¥é¡¼: ¿·¤·¤¤Ì¾Á°¤¬ÀßÄꤵ¤ì¤Þ¤»¤ó¤Ç¤·¤¿¤Î¤Ç¡¢');
+define('_SKINFILES_ERR_RENAME_FILE5',                  '¤Î̾Á°¤ÏÊѹ¹¤Ç¤­¤Þ¤»¤ó¤Ç¤·¤¿¡£ ');
+define('_SKINFILES_ERR_RENAME_FILE6',                  '¥¨¥é¡¼: ÀßÄꤷ¤¿Ì¾Á°¤Ë£±¤Ä°Ê¾å¤Î̵¸ú¤Êʸ»ú¤¬´Þ¤Þ¤ì¤Æ¤¤¤Þ¤·¤¿¤Î¤Ç ');
+define('_SKINFILES_ERR_RENAME_FILE7',                  '¤Î̾Á°¤ÏÊѹ¹¤Ç¤­¤Þ¤»¤ó¤Ç¤·¤¿¡£ ');
+define('_SKINFILES_ERR_RENAME_FILE8',                  '¥¨¥é¡¼: ÀßÄꤷ¤¿Ì¾Á°¤Ï¸µ¤Î̾Á°¤ÈƱ¤¸¤Ç¤·¤¿¤Î¤Ç ');
+define('_SKINFILES_ERR_RENAME_FILE9',                  '¤Î̾Á°¤ÏÊѹ¹¤Ç¤­¤Þ¤»¤ó¤Ç¤·¤¿¡£Ê̤Î̾Á°¤ò»ÈÍѤ·¤Æ²¼¤µ¤¤¡£ ');
+define('_SKINFILES_ERR_RENAME_FILE10',                 '¥¨¥é¡¼: ÀßÄꤷ¤¿Ì¾Á°¤Ï´û¤Ë¾¤Î¥Õ¥¡¥¤¥ë¤Þ¤¿¤Ï¥Ç¥£¥ì¥¯¥È¥ê¤Ë»ÈÍѤµ¤ì¤Æ¤¤¤Þ¤·¤¿¤Î¤Ç ');
+define('_SKINFILES_ERR_RENAME_FILE11',                 '¤Î̾Á°¤ÏÊѹ¹¤Ç¤­¤Þ¤»¤ó¤Ç¤·¤¿¡£');
+define('_SKINFILES_ERR_RENAME_FILE12',                 'Ê̤Î̾Á°¤ò»ÈÍѤ¹¤ë¤«¡¢¤Þ¤º´û¸¤Î¥Õ¥¡¥¤¥ë¤Þ¤¿¤Ï¥Ç¥£¥ì¥¯¥È¥ê¤òºï½ü¤·¤Æ²¼¤µ¤¤¡£');
+define('_SKINFILES_ERR_RENAME_FILE13',                 '¥¨¥é¡¼: ¥Õ¥¡¥¤¥ë ');
+define('_SKINFILES_ERR_RENAME_FILE14',                 '¤Î̾Á°¤ÏÊѹ¹¤Ç¤­¤Þ¤»¤ó¤Ç¤·¤¿¡£');
+define('_SKINFILES_ERR_RENAME_FILE15',                 '¥á¥Ã¥»¡¼¥¸: ¥Õ¥¡¥¤¥ë ');
+define('_SKINFILES_ERR_RENAME_FILE16',                 '¤ò ');
+define('_SKINFILES_ERR_RENAME_FILE17',                 ' ');
+define('_SKINFILES_ERR_RENAME_FILE18',                 ' ¤Ø̾Á°¤òÊѹ¹¤·¤Þ¤·¤¿¡£');
+
+define('_SKINFILES_ERR_CREATE_FILE1',                  '¥¨¥é¡¼: ¥Õ¥¡¥¤¥ë̾¤¬ÀßÄꤵ¤ì¤Þ¤»¤ó¤Ç¤·¤¿¤Î¤Ç¡¢¿·¤·¤¤¥Õ¥¡¥¤¥ë¤¬ºîÀ®¤Ç¤­¤Þ¤»¤ó¤Ç¤·¤¿¡£');
+define('_SKINFILES_ERR_CREATE_FILE2',                  '¥¨¥é¡¼: ÀßÄꤷ¤¿Ì¾Á°¤Ë£±¤Ä°Ê¾å¤Î̵¸ú¤Êʸ»ú¤¬´Þ¤Þ¤ì¤Æ¤¤¤Þ¤·¤¿¤Î¤Ç¡¢');
+define('_SKINFILES_ERR_CREATE_FILE3',                  '¤Ï¿·µ¬¤ËºîÀ®¤Ç¤­¤Þ¤»¤ó¤Ç¤·¤¿¡£');
+define('_SKINFILES_ERR_CREATE_FILE4',                  '¥¨¥é¡¼: ÀßÄꤷ¤¿Ì¾Á°¤Ï¤¹¤Ç¤Ë¾¤Î¥Õ¥¡¥¤¥ë¤Þ¤¿¤Ï¥Ç¥£¥ì¥¯¥È¥ê¤Ç»ÈÍѤµ¤ì¤Æ¤¤¤Þ¤·¤¿¤Î¤Ç¡¢');
+define('_SKINFILES_ERR_CREATE_FILE5',                  '¤Ï¿·µ¬¤ËºîÀ®¤Ç¤­¤Þ¤»¤ó¤Ç¤·¤¿¡£');
+define('_SKINFILES_ERR_CREATE_FILE6',                  'Ê̤Î̾Á°¤ò»ÈÍѤ¹¤ë¤«¡¢´û¸¤Î¥Õ¥¡¥¤¥ë¤Þ¤¿¤Ï¥Ç¥£¥ì¥¯¥È¥ê¤ò¤Þ¤ººï½ü¤·¤Æ²¼¤µ¤¤¡£');
+define('_SKINFILES_ERR_CREATE_FILE7',                  '¥¨¥é¡¼: ¥Õ¥¡¥¤¥ë ');
+define('_SKINFILES_ERR_CREATE_FILE8',                  '¤Ï¿·µ¬¤ËºîÀ®¤Ç¤­¤Þ¤»¤ó¤Ç¤·¤¿¡£');
+define('_SKINFILES_ERR_CREATE_FILE9',                  '¥á¥Ã¥»¡¼¥¸: ¥Õ¥¡¥¤¥ë ');
+define('_SKINFILES_ERR_CREATE_FILE10',                 ' ¤ò¿·µ¬¤ËºîÀ®¤·¤Þ¤·¤¿¡£');
+define('_SKINFILES_ERR_CREATE_FILE11',                 '¥¨¥é¡¼: ¥Ç¥£¥ì¥¯¥È¥ê ');
+define('_SKINFILES_ERR_CREATE_FILE12',                 ' ¤Ï¸ºß¤·¤Ê¤¤¤«');
+define('_SKINFILES_ERR_CREATE_FILE13',                 '¤½¤Î¥Ç¥£¥ì¥¯¥È¥ê¤Ë¥¢¥¯¥»¥¹¤¹¤ë¸¢¸Â¤¬¤¢¤ê¤Þ¤»¤ó¡£');
+
+define('_SKINFILES_ERR_DELETE_FILE1',                  '¥¨¥é¡¼: ¥Õ¥¡¥¤¥ë ');
+define('_SKINFILES_ERR_DELETE_FILE2',                  '¤Ï¸ºß¤·¤Ê¤¤¤«');
+define('_SKINFILES_ERR_DELETE_FILE3',                  '¤½¤Î¥Õ¥¡¥¤¥ë¤òºï½ü¤¹¤ë¸¢¸Â¤¬¤¢¤ê¤Þ¤»¤ó¡£');
+define('_SKINFILES_ERR_DELETE_FILE4',                  '¥¨¥é¡¼: ¥Õ¥¡¥¤¥ë¤òºï½ü¤Ç¤­¤Þ¤»¤ó¤Ç¤·¤¿¡£ ');
+define('_SKINFILES_ERR_DELETE_FILE5',                  '¥á¥Ã¥»¡¼¥¸: ¥Õ¥¡¥¤¥ë ');
+define('_SKINFILES_ERR_DELETE_FILE6',                  '¤òºï½ü¤·¤Þ¤·¤¿¡£');
+
+define('_SKINFILES_ERR_UPLOAD_FILE1',                  '¥¨¥é¡¼: ¥Õ¥¡¥¤¥ë ');
+define('_SKINFILES_ERR_UPLOAD_FILE2',                  '¤Î¥¢¥Ã¥×¥í¡¼¥É¤¬¤Ç¤­¤Þ¤»¤ó¤Ç¤·¤¿¡£');
+define('_SKINFILES_ERR_UPLOAD_FILE3',                  'ºÇÂç / ¸½ºß¤Î¥µ¥¤¥º: ');
+define('_SKINFILES_ERR_UPLOAD_FILE4',                  '¡£');
+define('_SKINFILES_ERR_UPLOAD_FILE5',                  '¥¨¥é¡¼: ÀßÄꤷ¤¿Ì¾Á°¤Ë£±¤Ä°Ê¾å¤Î̵¸ú¤Êʸ»ú¤¬´Þ¤Þ¤ì¤Æ¤¤¤Þ¤·¤¿¤Î¤Ç¡¢¥Õ¥¡¥¤¥ë ');
+define('_SKINFILES_ERR_UPLOAD_FILE6',                  '¤Î¥¢¥Ã¥×¥í¡¼¥É¤¬¤Ç¤­¤Þ¤»¤ó¤Ç¤·¤¿¡£');
+define('_SKINFILES_ERR_UPLOAD_FILE7',                  '¥á¥Ã¥»¡¼¥¸: ¥Õ¥¡¥¤¥ë ');
+define('_SKINFILES_ERR_UPLOAD_FILE8',                  '¤ò¥¢¥Ã¥×¥í¡¼¥É¤·¤Þ¤·¤¿¡£');
+define('_SKINFILES_ERR_UPLOAD_FILE9',                  '¥¨¥é¡¼: ¥Ç¥£¥ì¥¯¥È¥ê ');
+define('_SKINFILES_ERR_UPLOAD_FILE10',                 '¤Ï¸ºß¤·¤Ê¤¤¤«');
+define('_SKINFILES_ERR_UPLOAD_FILE11',                 '¤½¤Î¥Ç¥£¥ì¥¯¥È¥ê¤Ë¥¢¥¯¥»¥¹¤¹¤ë¸¢¸Â¤¬¤¢¤ê¤Þ¤»¤ó¡£');
+
+?>
diff --git a/euc/nucleus/plugins/skinfiles/japanese-utf8.php b/euc/nucleus/plugins/skinfiles/japanese-utf8.php
new file mode 100644 (file)
index 0000000..866f1ac
--- /dev/null
@@ -0,0 +1,178 @@
+<?php
+
+   /*
+       * @version $Id: japanese-utf8.php,v 1.2 2007-03-22 09:16:11 kimitake Exp $
+       * @version $NucleusJP: japanese-utf8.php,v 1.3 2007/02/04 06:28:46 kimitake Exp $
+       */
+
+define('_SKINFILES_TITLE',                             'スキンファイル');
+define('_SKINFILES_TOOLTIP',                   'スキンファイルの管理');
+
+define('_SKINFILES_MANAGEMENT',                        'スキンファイル管理');
+define('_SKINFILES_CURRENT_LOCATION',  '現在のディレクトリ: ');
+define('_SKINFILES_NAME',                              '名前');
+define('_SKINFILES_SIZE',                              'サイズ');
+define('_SKINFILES_LAST_MODIFIED',             '最終更新日');
+define('_SKINFILES_ACTIONS',                   'アクション');
+
+define('_SKINFILES_RENAME',                            '名前変更');
+define('_SKINFILES_RENAME_DIR_MSG',            'このディレクトリ名');
+define('_SKINFILES_RENAME_DIR_MSG2',   'を下記の名前に変更');
+define('_SKINFILES_EDIT_FILE_MSG',             'ファイルの編集');
+define('_SKINFILES_RENAME_FILE_MSG',   'ファイル');
+define('_SKINFILES_RENAME_FILE_MSG2',  'の名前を下記に変更:');
+define('_SKINFILES_DELETE',                            '削除');
+define('_SKINFILES_EDIT',                              '編集');
+define('_SKINFILES_CANCEL',                            'キャンセル');
+define('_SKINFILES_DOWNLOAD',                  'ダウンロード');
+define('_SKINFILES_SAVE_CHANGES',              '保存');
+
+define('_SKINFILES_DATE_FORMAT',               'Y/m/d H:i');
+
+define('_SKINFILES_CREATE_NEW_FILE',   '新規ファイルの作成');
+define('_SKINFILES_CREATE_NEW_DIR',            '新規ディレクトリの作成');
+define('_SKINFILES_CREATE_FILE',               'ファイル作成');
+define('_SKINFILES_CREATE',                            '作成');
+define('_SKINFILES_UPLOAD',                            'アップロード');
+define('_SKINFILES_DELETE_FILE',               'ファイル');
+define('_SKINFILES_DELETE_FILE2',              ' を削除しますか?');
+define('_SKINFILES_DELETE_DIR',                        'ディレクトリ');
+define('_SKINFILES_DELETE_DIR2',               ' を削除しますか?');
+define('_SKINFILES_DELETE_ALL',                        '全削除');
+define('_SKINFILES_DELETE_FILE_MSG',   'ディレクトリ');
+define('_SKINFILES_DELETE_FILE_MSG2',  ' から下記のファイルを削除しますか?');
+define('_SKINFILES_UPLOAD_NEW_FILE',   '新規ファイルのアップロード');
+define('_SKINFILES_DEL_ALL_FILES',             '現ディレクトリの全ファイル削除');
+define('_SKINFILES_DEL_ALL_FILES_MSG', '全ファイルを削除しますか? (最終確認あり)');
+
+define('_SKINFILES_VIEW_FILE',                         'ファイル表示 ');
+define('_SKINFILES_VIEW_FILE_IMG_INFO',                'イメージ情報');
+define('_SKINFILES_VIEW_FILE_TYPE',                    '種別');
+define('_SKINFILES_VIEW_FILE_WIDTH',           '横サイズ');
+define('_SKINFILES_VIEW_FILE_HEIGHT',          '縦サイズ');
+define('_SKINFILES_VIEW_FILE_PX',                      ' ピクセル');
+define('_SKINFILES_VIEW_FILE_CHANNELS',                'チャンネル数');
+define('_SKINFILES_VIEW_FILE_COLOR_DEPTH',     '色深度');
+define('_SKINFILES_VIEW_FILE_BITS',                    ' ビット');
+define('_SKINFILES_VIEW_FILE_COLORS',          '色数');
+define('_SKINFILES_VIEW_FILE_COLORS2',         ' 色');
+
+
+define('_SKINFILES_ERR_DIR_DOES_NOT_CONTAIN',  'このディレクトリにはファイル・ディレクトリが存在しません。');
+define('_SKINFILES_ERR_DIR_DOES_NOT_EXIST1',   'エラー: ディレクトリ ');
+define('_SKINFILES_ERR_DIR_DOES_NOT_EXIST2',   'は存在しないか、');
+define('_SKINFILES_ERR_DIR_DOES_NOT_EXIST3',   'そのディレクトリ名を変更する権限がありません。');
+
+define('_SKINFILES_ERR_COULD_NOT_RENAME_DIR1', 'エラー: 新しい名前が設定されませんでしたので ');
+define('_SKINFILES_ERR_COULD_NOT_RENAME_DIR2', 'は変更できませんでした。');
+define('_SKINFILES_ERR_COULD_NOT_RENAME_DIR3', 'エラー: 設定した名前に1つ以上の無効な文字が含まれていましたので ');
+define('_SKINFILES_ERR_COULD_NOT_RENAME_DIR4', 'は変更できませんでした。');
+define('_SKINFILES_ERR_COULD_NOT_RENAME_DIR5', 'エラー: 設定した名前は元の名前と同じでしたので ');
+define('_SKINFILES_ERR_COULD_NOT_RENAME_DIR6', 'は変更できませんでした。');
+define('_SKINFILES_ERR_COULD_NOT_RENAME_DIR7', '別の名前を設定して下さい。');
+define('_SKINFILES_ERR_COULD_NOT_RENAME_DIR8', 'エラー: 設定した名前は既に他のファイルやディレクトリに使用されていましたので ');
+define('_SKINFILES_ERR_COULD_NOT_RENAME_DIR9', 'は変更できませんでした。');
+define('_SKINFILES_ERR_COULD_NOT_RENAME_DIR10',        '別の名前を使用するか、まず既存のファイルまたはディレクトリを削除して下さい。');
+define('_SKINFILES_ERR_COULD_NOT_RENAME_DIR11',        'エラー: 次のディレクトリ名を変更できませんでした。 ');
+
+define('_SKINFILES_RENAMED_DIR1',                              'メッセージ: ディレクトリ ');
+define('_SKINFILES_RENAMED_DIR2',                              'の名前を ');
+define('_SKINFILES_RENAMED_DIR3',                              '');
+define('_SKINFILES_RENAMED_DIR4',                              ' に変更しました。');
+
+define('_SKINFILES_ERR_COULD_NOT_CREATE_DIR1', 'エラー: 名前が設定されませんでしたので、新規にディレクトリを作成できませんでした。 ');
+define('_SKINFILES_ERR_COULD_NOT_CREATE_DIR2', 'エラー: 設定した名前に1つ以上の無効な文字が含まれていましたので ');
+define('_SKINFILES_ERR_COULD_NOT_CREATE_DIR3', '新規にディレクトリを作成できませんでした。');
+define('_SKINFILES_ERR_COULD_NOT_CREATE_DIR4', 'エラー: 設定した名前は既に他のファイルまたはディレクトリに使用されていましたので ');
+define('_SKINFILES_ERR_COULD_NOT_CREATE_DIR5', ' のディレクトリを新規で作成できませんでした。');
+define('_SKINFILES_ERR_COULD_NOT_CREATE_DIR6', '別の名前を使用するか、まず既存のファイルまたはディレクトリを削除して下さい。');
+define('_SKINFILES_ERR_COULD_NOT_CREATE_DIR7', 'メッセージ: ディレクトリ ');
+define('_SKINFILES_ERR_COULD_NOT_CREATE_DIR8', 'を作成しました。');
+define('_SKINFILES_ERR_COULD_NOT_CREATE_DIR9', 'エラー: ディレクトリ ');
+define('_SKINFILES_ERR_COULD_NOT_CREATE_DIR10',        'は存在しないか');
+define('_SKINFILES_ERR_COULD_NOT_CREATE_DIR11',        'そのディレクトリにアクセスする権限がありません。');
+
+define('_SKINFILES_ERR_DELETE_DIR1',                   'エラー: ディレクトリ ');
+define('_SKINFILES_ERR_DELETE_DIR2',                   'は存在しないか');
+define('_SKINFILES_ERR_DELETE_DIR3',                   'そのディレクトリを削除する権限がありません。');
+define('_SKINFILES_ERR_DELETE_DIR4',                   'エラー: ディレクトリを削除できませんでした。');
+define('_SKINFILES_ERR_DELETE_DIR5',                   'メッセージ: ディレクトリ ');
+define('_SKINFILES_ERR_DELETE_DIR6',                   'を削除しました。');
+define('_SKINFILES_ERR_DELETE_DIR7',                   '現在このディレクトリには削除できるファイルはありません。');
+
+define('_SKINFILES_ERR_EMPTY_DIR1',                            'メッセージ: ファイル ');
+define('_SKINFILES_ERR_EMPTY_DIR2',                            'を削除しました。');
+define('_SKINFILES_ERR_EMPTY_DIR3',                            'エラー: ファイル ');
+define('_SKINFILES_ERR_EMPTY_DIR4',                            'は削除できませんでした。');
+define('_SKINFILES_ERR_EMPTY_DIR5',                            'エラー: ディレクトリ ');
+define('_SKINFILES_ERR_EMPTY_DIR6',                            'は存在しないか');
+define('_SKINFILES_ERR_EMPTY_DIR7',                            'そのディレクトリにアクセスする権限がありません。');
+
+define('_SKINFILES_ERR_DOWNLOAD_FILE1',                        'エラー: ファイルにアクセスできませんでした。');
+define('_SKINFILES_ERR_DOWNLOAD_FILE2',                        'エラー: そのファイルにアクセスする権限がありませんでした。');
+
+define('_SKINFILES_ERR_VIEW_FILE1',                            'エラー: ファイル ');
+define('_SKINFILES_ERR_VIEW_FILE2',                            'は存在しないか');
+define('_SKINFILES_ERR_VIEW_FILE3',                            'そのファイルを参照する権限がありません。');
+
+define('_SKINFILES_ERR_EDIT_FILE1',                            'エラー: ファイル ');
+define('_SKINFILES_ERR_EDIT_FILE2',                            'は存在しないか');
+define('_SKINFILES_ERR_EDIT_FILE3',                            'そのファイルを編集する権限がありません。');
+define('_SKINFILES_ERR_EDIT_FILE4',                            'メッセージ: ファイル ');
+define('_SKINFILES_ERR_EDIT_FILE5',                            'を保存しました。');
+define('_SKINFILES_ERR_EDIT_FILE6',                            'エラー: ファイル ');
+define('_SKINFILES_ERR_EDIT_FILE7',                            'は保存できませんでした。');
+
+define('_SKINFILES_ERR_RENAME_FILE1',                  'エラー: ファイル ');
+define('_SKINFILES_ERR_RENAME_FILE2',                  'は存在しないか');
+define('_SKINFILES_ERR_RENAME_FILE3',                  'そのファイル名を変更する権限がありません。');
+define('_SKINFILES_ERR_RENAME_FILE4',                  'エラー: 新しい名前が設定されませんでしたので、');
+define('_SKINFILES_ERR_RENAME_FILE5',                  'の名前は変更できませんでした。 ');
+define('_SKINFILES_ERR_RENAME_FILE6',                  'エラー: 設定した名前に1つ以上の無効な文字が含まれていましたので ');
+define('_SKINFILES_ERR_RENAME_FILE7',                  'の名前は変更できませんでした。 ');
+define('_SKINFILES_ERR_RENAME_FILE8',                  'エラー: 設定した名前は元の名前と同じでしたので ');
+define('_SKINFILES_ERR_RENAME_FILE9',                  'の名前は変更できませんでした。別の名前を使用して下さい。 ');
+define('_SKINFILES_ERR_RENAME_FILE10',                 'エラー: 設定した名前は既に他のファイルまたはディレクトリに使用されていましたので ');
+define('_SKINFILES_ERR_RENAME_FILE11',                 'の名前は変更できませんでした。');
+define('_SKINFILES_ERR_RENAME_FILE12',                 '別の名前を使用するか、まず既存のファイルまたはディレクトリを削除して下さい。');
+define('_SKINFILES_ERR_RENAME_FILE13',                 'エラー: ファイル ');
+define('_SKINFILES_ERR_RENAME_FILE14',                 'の名前は変更できませんでした。');
+define('_SKINFILES_ERR_RENAME_FILE15',                 'メッセージ: ファイル ');
+define('_SKINFILES_ERR_RENAME_FILE16',                 'を ');
+define('_SKINFILES_ERR_RENAME_FILE17',                 ' ');
+define('_SKINFILES_ERR_RENAME_FILE18',                 ' へ名前を変更しました。');
+
+define('_SKINFILES_ERR_CREATE_FILE1',                  'エラー: ファイル名が設定されませんでしたので、新しいファイルが作成できませんでした。');
+define('_SKINFILES_ERR_CREATE_FILE2',                  'エラー: 設定した名前に1つ以上の無効な文字が含まれていましたので、');
+define('_SKINFILES_ERR_CREATE_FILE3',                  'は新規に作成できませんでした。');
+define('_SKINFILES_ERR_CREATE_FILE4',                  'エラー: 設定した名前はすでに他のファイルまたはディレクトリで使用されていましたので、');
+define('_SKINFILES_ERR_CREATE_FILE5',                  'は新規に作成できませんでした。');
+define('_SKINFILES_ERR_CREATE_FILE6',                  '別の名前を使用するか、既存のファイルまたはディレクトリをまず削除して下さい。');
+define('_SKINFILES_ERR_CREATE_FILE7',                  'エラー: ファイル ');
+define('_SKINFILES_ERR_CREATE_FILE8',                  'は新規に作成できませんでした。');
+define('_SKINFILES_ERR_CREATE_FILE9',                  'メッセージ: ファイル ');
+define('_SKINFILES_ERR_CREATE_FILE10',                 ' を新規に作成しました。');
+define('_SKINFILES_ERR_CREATE_FILE11',                 'エラー: ディレクトリ ');
+define('_SKINFILES_ERR_CREATE_FILE12',                 ' は存在しないか');
+define('_SKINFILES_ERR_CREATE_FILE13',                 'そのディレクトリにアクセスする権限がありません。');
+
+define('_SKINFILES_ERR_DELETE_FILE1',                  'エラー: ファイル ');
+define('_SKINFILES_ERR_DELETE_FILE2',                  'は存在しないか');
+define('_SKINFILES_ERR_DELETE_FILE3',                  'そのファイルを削除する権限がありません。');
+define('_SKINFILES_ERR_DELETE_FILE4',                  'エラー: ファイルを削除できませんでした。 ');
+define('_SKINFILES_ERR_DELETE_FILE5',                  'メッセージ: ファイル ');
+define('_SKINFILES_ERR_DELETE_FILE6',                  'を削除しました。');
+
+define('_SKINFILES_ERR_UPLOAD_FILE1',                  'エラー: ファイル ');
+define('_SKINFILES_ERR_UPLOAD_FILE2',                  'のアップロードができませんでした。');
+define('_SKINFILES_ERR_UPLOAD_FILE3',                  '最大 / 現在のサイズ: ');
+define('_SKINFILES_ERR_UPLOAD_FILE4',                  '。');
+define('_SKINFILES_ERR_UPLOAD_FILE5',                  'エラー: 設定した名前に1つ以上の無効な文字が含まれていましたので、ファイル ');
+define('_SKINFILES_ERR_UPLOAD_FILE6',                  'のアップロードができませんでした。');
+define('_SKINFILES_ERR_UPLOAD_FILE7',                  'メッセージ: ファイル ');
+define('_SKINFILES_ERR_UPLOAD_FILE8',                  'をアップロードしました。');
+define('_SKINFILES_ERR_UPLOAD_FILE9',                  'エラー: ディレクトリ ');
+define('_SKINFILES_ERR_UPLOAD_FILE10',                 'は存在しないか');
+define('_SKINFILES_ERR_UPLOAD_FILE11',                 'そのディレクトリにアクセスする権限がありません。');
+
+?>
index a9173b3..f8e85b2 100755 (executable)
@@ -1,40 +1,40 @@
-/*\r
-       This stylesheet serves to make item previews look nicer, and to markup the \r
-       buttonbar\r
-       \r
-       $Id: addedit.css,v 1.3 2005-03-16 08:11:09 kimitake Exp $\r
-       $NucleusJP: addedit.css,v 1.4 2005/03/15 08:08:52 kimitake Exp $\r
-*/\r
-\r
-.leftbox, .rightbox {\r
-       margin: 3px;\r
-       padding: 3px;\r
-       font-size: larger;\r
-       width: 20%;\r
-}\r
-.leftbox {\r
-       float: left;\r
-       border-right: 2px solid #888;   \r
-}\r
-.rightbox {\r
-       float: right;\r
-       border-left: 2px solid #888;    \r
-}\r
-\r
-/* markup buttons */\r
-.jsbutton {\r
-       text-align: center; \r
-\r
-       padding: 3px;\r
-       border: 1px solid #dddddd;\r
-}\r
-\r
-.jsbuttonspacer {\r
-       padding-right: 10px;\r
-}\r
-\r
-.jsbuttonbar {\r
-       padding: 3px;\r
-       cursor: default;\r
-}\r
-\r
+/*
+       This stylesheet serves to make item previews look nicer, and to markup the 
+       buttonbar
+       
+       $Id: addedit.css,v 1.4 2007-03-22 09:18:16 kimitake Exp $
+       $NucleusJP: addedit.css,v 1.6 2006/07/17 20:03:45 kimitake Exp $
+*/
+
+.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 */
+.jsbutton {
+       text-align: center; 
+
+       padding: 3px;
+       border: 1px solid #dddddd;
+}
+
+.jsbuttonspacer {
+       padding-right: 10px;
+}
+
+.jsbuttonbar {
+       padding: 3px;
+       cursor: default;
+}
+
index af2bac1..57dc07c 100755 (executable)
@@ -1,8 +1,8 @@
 /*
        admin area style
        
-       $Id: admin.css,v 1.6 2007-03-22 08:32:35 kimitake Exp $
-       $NucleusJP: admin.css,v 1.5 2005/08/13 07:26:38 kimitake Exp $
+       $Id: admin.css,v 1.7 2007-03-22 09:18:16 kimitake Exp $
+       $NucleusJP: admin.css,v 1.7 2006/07/18 08:43:24 kimitake Exp $
 */
 
 body {
@@ -52,7 +52,7 @@ h1 {
 
 /* page content */
 #content {
-   margin-left:135px;
+   margin-left:155px;
        font-style: normal;
        text-decoration: none;
        color: black;
@@ -86,7 +86,7 @@ h1 {
        top: 10px;
        left: 10px;
 
-       width: 110px;
+       width: 130px;
        margin: 0px;
        padding: 0px;
        
index 19b05da..ddf5366 100755 (executable)
-/* \r
-       style definitions for the bookmarklet \r
-       \r
-       $Id: bookmarklet.css,v 1.3 2005-03-16 08:11:09 kimitake Exp $\r
-       $NucleusJP: bookmarklet.css,v 1.3 2005/03/12 06:19:06 kimitake Exp $\r
-*/\r
-\r
-body {\r
-       font-size: small;\r
-       background: #fff;\r
-       color: #000;\r
-    font-family: "Trebuchet MS",Trebuchet,"Bitstream Vera Sans",verdana,lucida,arial,helvetica,sans-serif\r
-}              \r
-\r
-textarea {\r
-  font-family: "Hiragino Kaku Gothic Pro W3", "MS PGothic", "Osaka", sans-serif;\r
-}\r
-\r
-h1 {\r
-       border-bottom: 1px dotted gray;\r
-       font-size: medium;\r
-       color: #596d9d;\r
-}\r
-\r
-/* \r
-       Hide switch buttons initially, we'll enable them again if we are sure\r
-       the browser supports DOM\r
-*/\r
-#switchbuttons {\r
-       display: none;\r
-}\r
-/*\r
-       Hide preview also when no DOM is supported\r
-*/\r
-#preview {\r
-       display: none;\r
-}\r
-\r
-.buttonbar {\r
-   margin-bottom: 5px;\r
-   background: rgb(187, 187, 204);\r
-   padding: 3px;\r
-}\r
-\r
-.buttonbar input {\r
-   background: #C5C5D3;\r
-    border: 1px solid #CACAD7;\r
-    border-right: 2px solid #8E8EAB;\r
-    border-bottom: 2px solid #8E8EAB;\r
-    color: #000000;\r
-    font-family: "Trebuchet MS",Trebuchet,"Bitstream Vera Sans",verdana,lucida,arial,helvetica,sans-serif;\r
-    font-weight: bold;   \r
-}\r
-\r
-.contentblock {\r
-       /*background: #ddd;*/\r
-       height: 400px;\r
-       overflow: auto; /* temporary removed, to make the select box work in Mozilla */\r
-       padding: 1px;\r
-    margin: 0px;\r
-       vertical-align: top;\r
-}\r
-\r
-.shortcuts {\r
-       float: right; \r
-       text-align: right;\r
-       font-size: x-small;\r
-}\r
-\r
-#options {\r
-   margin-top:-15px;\r
-   }\r
-#options h2 {\r
-   margin:15px 0 0 0;\r
-}\r
-\r
-h2 {\r
-   font-size: 1.5em;\r
-   color: gray;\r
-    margin-top: 0px;\r
-    padding-top: 0px;\r
-    padding-bottom: 0px;\r
-    margin-top: 0px;\r
-}\r
-\r
-a:link, a:visited {\r
-       color: #1D3565; \r
-       font-weight: bold;\r
-       text-decoration: none;\r
-}\r
-\r
-a:hover {\r
-       text-decoration: underline;\r
-}                      \r
-\r
-img { \r
-       border: none;\r
-}\r
-\r
-.indent {\r
-       margin-left: 40px;\r
-}\r
-\r
-label          { cursor: pointer; }\r
-\r
-table {\r
-       border: none;\r
-       width: 95%;\r
-       border-collapse: collapse;\r
-       margin-bottom: 10px;\r
-       margin-top: 10px;       \r
-}\r
-\r
-th {\r
-       background: #bbc;\r
-       color: #000;\r
-       font-size: small;\r
-}\r
-\r
-th, td {\r
-       padding: 4px;\r
-       empty-cells: show;      \r
-}\r
-\r
-td {\r
-       background: #fff;\r
-       border: 1px solid #ddd;\r
-       font-size: small;\r
-       vertical-align: top;\r
-       text-align: left;\r
-}\r
-\r
-td a:link, td a:visited { \r
-       text-decoration: underline;\r
-       color: black;\r
-       font-weight: normal;\r
-}\r
-td a:hover {\r
-       color: #1D3565;\r
-       text-decoration: underline;\r
-}\r
-\r
-td.draft, td.future {\r
-       background: #ffe;\r
-}\r
-\r
-tr.highlighted td {\r
-       background: green;\r
-}\r
-\r
-ul.nobullets {\r
-       list-style-type: none;\r
-       padding: 0;\r
-       margin: 0;\r
-}\r
+/* 
+       style definitions for the bookmarklet 
+       
+       $Id: bookmarklet.css,v 1.4 2007-03-22 09:18:16 kimitake Exp $
+       $NucleusJP: bookmarklet.css,v 1.6 2007/01/30 07:35:20 kimitake Exp $
+*/
+
+body {
+       font-size: small;
+       background: #fff;
+       color: #000;
+    font-family: "Trebuchet MS",Trebuchet,"Bitstream Vera Sans",verdana,lucida,arial,helvetica,sans-serif;
+}              
+
+textarea {
+       font-family: "Hiragino Kaku Gothic Pro W3", "MS P Gothic", "Osaka", sans-serif;
+}
+
+h1 {
+       border-bottom: 1px dotted gray;
+       font-size: medium;
+       color: #596d9d;
+}
+
+/* 
+       Hide switch buttons initially, we'll enable them again if we are sure
+       the browser supports DOM
+*/
+#switchbuttons {
+       display: none;
+}
+/*
+       Hide preview also when no DOM is supported
+*/
+#preview {
+       display: none;
+}
+
+.buttonbar {
+   margin-bottom: 5px;
+   background: rgb(187, 187, 204);
+   padding: 3px;
+}
+
+.buttonbar input {
+   background: #C5C5D3;
+    border: 1px solid #CACAD7;
+    border-right: 2px solid #8E8EAB;
+    border-bottom: 2px solid #8E8EAB;
+    color: #000000;
+    font-family: "Trebuchet MS",Trebuchet,"Bitstream Vera Sans",verdana,lucida,arial,helvetica,sans-serif;
+    font-weight: bold;   
+}
+
+.contentblock {
+       /*background: #ddd;*/
+       height: 400px;
+       overflow: auto; /* temporary removed, to make the select box work in Mozilla */
+       padding: 1px;
+    margin: 0px;
+       vertical-align: top;
+}
+
+.shortcuts {
+       float: right; 
+       text-align: right;
+       font-size: x-small;
+}
+
+#options {
+   margin-top:-15px;
+   }
+#options h2 {
+   margin:15px 0 0 0;
+}
+
+h2 {
+   font-size: 1.5em;
+   color: gray;
+    margin-top: 0px;
+    padding-top: 0px;
+    padding-bottom: 0px;
+    margin-top: 0px;
+}
+
+a:link, a:visited {
+       color: #1D3565; 
+       font-weight: bold;
+       text-decoration: none;
+}
+
+a:hover {
+       text-decoration: underline;
+}                      
+
+img { 
+       border: none;
+}
+
+.indent {
+       margin-left: 40px;
+}
+
+label          { cursor: pointer; }
+
+table {
+       border: none;
+       width: 95%;
+       border-collapse: collapse;
+       margin-bottom: 10px;
+       margin-top: 10px;       
+}
+
+th {
+       background: #bbc;
+       color: #000;
+       font-size: small;
+}
+
+th, td {
+       padding: 4px;
+       empty-cells: show;      
+}
+
+td {
+       background: #fff;
+       border: 1px solid #ddd;
+       font-size: small;
+       vertical-align: top;
+       text-align: left;
+}
+
+td a:link, td a:visited { 
+       text-decoration: underline;
+       color: black;
+       font-weight: normal;
+}
+td a:hover {
+       color: #1D3565;
+       text-decoration: underline;
+}
+
+td.draft, td.future {
+       background: #ffe;
+}
+
+tr.highlighted td {
+       background: green;
+}
+
+ul.nobullets {
+       list-style-type: none;
+       padding: 0;
+       margin: 0;
+}
\ No newline at end of file
index cab6b45..aa1e621 100755 (executable)
-/*\r
-       documentation style\r
-       \r
-       $Id: manual.css,v 1.3 2005-03-16 08:11:09 kimitake Exp $\r
-       $NucleusJP: manual.css,v 1.3 2005/03/12 06:19:06 kimitake Exp $\r
-*/\r
-\r
-body {\r
-       background-color: #fff;\r
-       color: #000;\r
-       font-family: verdana, arial;\r
-       font-size: small;\r
-}\r
-\r
-@media screen {\r
-       body {\r
-               margin-left: 10%;\r
-               margin-right: 10%;\r
-       }\r
-}\r
-\r
-@media print {\r
-       pre, .note, td, th {\r
-               border: 1px dashed gray;\r
-       }\r
-}\r
-\r
-img {\r
-       border: none;\r
-}\r
-\r
-a:link, a:visited {\r
-       color: #1D3565; \r
-       font-weight: bold;\r
-       text-decoration: none;\r
-}\r
-a: hover {\r
-       text-decoration: underline;\r
-}\r
-\r
-.heading {\r
-       text-align: center;\r
-       font-size: xx-large;\r
-       font-weight: bold;\r
-       color: gray;    \r
-}\r
-\r
-.heading i {\r
-       position: absolute;\r
-       top: 5px;\r
-       right: 5px;\r
-       font-size: small;\r
-       font-style: normal;\r
-       font-weight: normal;\r
-}\r
-\r
-p:first-letter {\r
-       font-size: large;\r
-}\r
-\r
-p {\r
-       text-indent: 20px;\r
-}\r
-\r
-h1 {\r
-       border-bottom: 1px dotted gray;\r
-       font-size: x-large;\r
-       color: #596d9d;\r
-}\r
-\r
-h2 {\r
-       color: gray;\r
-       font-size: large;\r
-       margin-left: 20px;\r
-       text-indent: 10px;\r
-       border-bottom: 1px solid #ddd;\r
-}\r
-\r
-pre, .note, .faq .answer {\r
-       background-color: #ddd;\r
-       padding: 10px;\r
-       font-size: small;\r
-}\r
-\r
-.screenshot {\r
-       text-align: center;\r
-       background-color: #ddd;\r
-       padding: 10px;\r
-}\r
-\r
-.faq .question {\r
-       font-weight: bold;\r
-       margin-bottom: 0px;\r
-}\r
-\r
-.faq .answer {\r
-\r
-}\r
-\r
-.faq {\r
-       margin-bottom: 20px;\r
-}\r
-\r
-table {\r
-       border: none;\r
-}\r
-\r
-th {\r
-       background-color: linen;\r
-       font-size: medium;\r
-}\r
-\r
-th, td {\r
-       padding: 5px;\r
-}\r
-\r
-td {\r
-       background-color: #dddddd;\r
-       font-size: small;\r
-       vertical-align: top;\r
-       text-align: left;\r
-}\r
-\r
-input, select, option, textarea {\r
-       background-color: transparent;\r
-}\r
-\r
-.deprecated {\r
-       border: 3px solid red;\r
-       padding: 5px;\r
-       font-size: medium;\r
-}\r
-\r
-tt, code, samp {\r
-       font-size: small;\r
-}\r
-\r
-.warning {\r
-       color: red;\r
-}\r
-.ok {\r
-       color: green;\r
-}\r
-\r
-acronym, abbr {\r
-       border-bottom: 1px dotted gray;\r
-       cursor: help;\r
-}\r
-\r
-label {\r
-       cursor: hand;\r
-}\r
+/*
+       documentation style
+       
+       $Id: manual.css,v 1.4 2007-03-22 09:18:16 kimitake Exp $
+       $NucleusJP: manual.css,v 1.5 2006/07/17 20:03:45 kimitake Exp $
+*/
+
+body {
+       background-color: #fff;
+       color: #000;
+       font-family: verdana, arial;
+       font-size: small;
+}
+
+@media screen {
+       body {
+               margin-left: 10%;
+               margin-right: 10%;
+       }
+}
+
+@media print {
+       pre, .note, td, th {
+               border: 1px dashed gray;
+       }
+}
+
+img {
+       border: none;
+}
+
+a:link, a:visited {
+       color: #1D3565; 
+       font-weight: bold;
+       text-decoration: none;
+}
+a: hover {
+       text-decoration: underline;
+}
+
+.heading {
+       text-align: center;
+       font-size: xx-large;
+       font-weight: bold;
+       color: gray;    
+}
+
+.heading i {
+       position: absolute;
+       top: 5px;
+       right: 5px;
+       font-size: small;
+       font-style: normal;
+       font-weight: normal;
+}
+
+p:first-letter {
+       font-size: large;
+}
+
+p {
+       text-indent: 20px;
+}
+
+h1 {
+       border-bottom: 1px dotted gray;
+       font-size: x-large;
+       color: #596d9d;
+}
+
+h2 {
+       color: gray;
+       font-size: large;
+       margin-left: 20px;
+       text-indent: 10px;
+       border-bottom: 1px solid #ddd;
+}
+
+pre, .note, .faq .answer {
+       background-color: #ddd;
+       padding: 10px;
+       font-size: small;
+}
+
+.screenshot {
+       text-align: center;
+       background-color: #ddd;
+       padding: 10px;
+}
+
+.faq .question {
+       font-weight: bold;
+       margin-bottom: 0px;
+}
+
+.faq .answer {
+
+}
+
+.faq {
+       margin-bottom: 20px;
+}
+
+table {
+       border: none;
+}
+
+th {
+       background-color: linen;
+       font-size: medium;
+}
+
+th, td {
+       padding: 5px;
+}
+
+td {
+       background-color: #dddddd;
+       font-size: small;
+       vertical-align: top;
+       text-align: left;
+}
+
+input, select, option, textarea {
+       background-color: transparent;
+}
+
+.deprecated {
+       border: 3px solid red;
+       padding: 5px;
+       font-size: medium;
+}
+
+tt, code, samp {
+       font-size: small;
+}
+
+.warning {
+       color: red;
+}
+.ok {
+       color: green;
+}
+
+acronym, abbr {
+       border-bottom: 1px dotted gray;
+       cursor: help;
+}
+
+label {
+       cursor: hand;
+}
index f224d23..be61847 100755 (executable)
-/*\r
-       media library popup\r
-       \r
-       $Id: popups.css,v 1.3 2005-03-16 08:11:09 kimitake Exp $\r
-       $NucleusJP: popups.css,v 1.3 2005/03/12 06:19:06 kimitake Exp $\r
-*/\r
-\r
-body {\r
-       font-family: verdana, arial;\r
-       font-size: small;\r
-       background-color: #fff;\r
-       color: #000;\r
-}\r
-\r
-img {\r
-       border: none;\r
-}\r
-\r
-a:link, a:visited {\r
-       color: #1D3565; \r
-       font-weight: bold;\r
-       text-decoration: none;\r
-}\r
-a:hover {\r
-       text-decoration: underline;\r
-}\r
-\r
-.heading {\r
-       text-align: center;\r
-       font-size: xx-large;\r
-       font-weight: bold;\r
-       color: gray;    \r
-}\r
-\r
-.heading i {\r
-       position: absolute;\r
-       top: 5px;\r
-       right: 5px;\r
-       font-size: small;\r
-       font-style: normal;\r
-       font-weight: normal;\r
-}\r
-\r
-p {\r
-       text-indent: 20px;\r
-}\r
-\r
-h1 {\r
-       border-bottom: 1px dotted gray;\r
-       font-size: x-large;\r
-       color: #596d9d;\r
-}\r
-\r
-h2 {\r
-       color: gray;\r
-       font-size: large;\r
-       margin-left: 20px;\r
-       text-indent: 10px;\r
-       border-bottom: 1px solid #ddd;\r
-}\r
-\r
-pre, .note, .faq .answer {\r
-       background-color: #ddd;\r
-       padding: 10px;\r
-       font-size: small;\r
-}\r
-\r
-.faq .question {\r
-       font-weight: bold;\r
-       margin-bottom: 0px;\r
-}\r
-\r
-.faq .answer {\r
-\r
-}\r
-\r
-.faq {\r
-       margin-bottom: 20px;\r
-}\r
-\r
-table {\r
-       border: none;\r
-}\r
-\r
-th {\r
-       background-color: linen;\r
-       font-size: medium;\r
-}\r
-\r
-th, td {\r
-       padding: 5px;\r
-}\r
-\r
-td {\r
-       background-color: #dddddd;\r
-       font-size: small;\r
-       vertical-align: top;\r
-       text-align: left;\r
-}\r
-\r
-label {\r
-       cursor: pointer;\r
-}\r
+/*
+       media library popup
+       
+       $Id: popups.css,v 1.4 2007-03-22 09:18:16 kimitake Exp $
+       $NucleusJP: popups.css,v 1.5 2006/07/17 20:03:45 kimitake Exp $
+*/
+
+body {
+       font-family: verdana, arial;
+       font-size: small;
+       background-color: #fff;
+       color: #000;
+}
+
+img {
+       border: none;
+}
+
+a:link, a:visited {
+       color: #1D3565; 
+       font-weight: bold;
+       text-decoration: none;
+}
+a:hover {
+       text-decoration: underline;
+}
+
+.heading {
+       text-align: center;
+       font-size: xx-large;
+       font-weight: bold;
+       color: gray;    
+}
+
+.heading i {
+       position: absolute;
+       top: 5px;
+       right: 5px;
+       font-size: small;
+       font-style: normal;
+       font-weight: normal;
+}
+
+p {
+       text-indent: 20px;
+}
+
+h1 {
+       border-bottom: 1px dotted gray;
+       font-size: x-large;
+       color: #596d9d;
+}
+
+h2 {
+       color: gray;
+       font-size: large;
+       margin-left: 20px;
+       text-indent: 10px;
+       border-bottom: 1px solid #ddd;
+}
+
+pre, .note, .faq .answer {
+       background-color: #ddd;
+       padding: 10px;
+       font-size: small;
+}
+
+.faq .question {
+       font-weight: bold;
+       margin-bottom: 0px;
+}
+
+.faq .answer {
+
+}
+
+.faq {
+       margin-bottom: 20px;
+}
+
+table {
+       border: none;
+}
+
+th {
+       background-color: linen;
+       font-size: medium;
+}
+
+th, td {
+       padding: 5px;
+}
+
+td {
+       background-color: #dddddd;
+       font-size: small;
+       vertical-align: top;
+       text-align: left;
+}
+
+label {
+       cursor: pointer;
+}
\ No newline at end of file
index c31da0d..d9134bf 100755 (executable)
@@ -1,8 +1,8 @@
-<?php\r
-// RSD file (http://archipelago.phrasewise.com/rsd)\r
-$CONF = array();\r
-include('./config.php');\r
-selectSkin('xml/rsd');\r
-selector();\r
-\r
-?>\r
+<?php
+// RSD file (http://archipelago.phrasewise.com/rsd)
+$CONF = array();
+include('./config.php');
+selectSkin('xml/rsd');
+selector();
+
+?>
\ No newline at end of file
index 74b3d00..294c1f3 100644 (file)
-/*-------------------------------------------------\r
-  Nucleus CMS Stylesheet - bundled with version 3.2\r
-  Based on the Stanch skin by Ivan Fong\r
-  Mods by hcgtv and moraes\r
--------------------------------------------------*/\r
-\r
-/*-------------------------------------------------\r
-  General layout\r
--------------------------------------------------*/\r
-body\r
-{\r
-       background: #505050 url(images/bg.gif);\r
-       color: #494949;\r
-       font-family: "Lucida Grande", "Lucida Sans Unicode", "Trebuchet MS", Trebuchet, Arial, sans-serif;\r
-       font-size: 11px;\r
-       padding: 15px 0;\r
-       margin: 0;\r
-}\r
-img\r
-{\r
-       border: 0;\r
-}\r
-form\r
-{\r
-       margin: 0;\r
-}\r
-\r
-/* Headings */\r
-h1,h2,h3,h4,h5,h6\r
-{\r
-    font-family: "Georgia", "Lucida Grande", "Lucida Sans Unicode", "Trebuchet MS", Trebuchet, Arial, sans-serif;\r
-       font-weight: normal;\r
-       margin: 0;\r
-}\r
-\r
-/* Lists */\r
-ul\r
-{\r
-       list-style: none;\r
-       padding: 0;\r
-       margin: 0;\r
-}\r
-li\r
-{\r
-       background: url(images/arrow.gif) left 5px no-repeat;\r
-       padding: 0 0 0 10px;\r
-       margin: 0 20px;\r
-}\r
-\r
-/* Links */\r
-a:link, a:visited\r
-{\r
-       color: #635D45;\r
-       text-decoration: none;\r
-}\r
-a:hover, a:active\r
-{\r
-       color: black;\r
-}\r
-#header a:link, #header a:visited\r
-{\r
-       color: #474747;\r
-}\r
-#header a:hover, #header a:active\r
-{\r
-       color: #737373;\r
-}\r
-#copyrights a:link, #copyrights a:visited\r
-{\r
-       color: #474747;\r
-}\r
-#copyrights a:hover, #copyrights a:active\r
-{\r
-       color: #737373;\r
-}\r
-\r
-/* Basic classes */\r
-.hidden\r
-{\r
-       display: none;\r
-}\r
-.centerize\r
-{\r
-       text-align: center;\r
-}\r
-.clearing\r
-{\r
-       width: 704px;\r
-       height: 0;\r
-       clear: both;\r
-}\r
-\r
-/*-------------------------------------------------\r
-  Header\r
--------------------------------------------------*/\r
-#header\r
-{\r
-       position: relative;\r
-       width: 704px;\r
-       height: 168px;\r
-       /* large header image is defined below */\r
-       /* background: white url(images/header.jpg) no-repeat; */\r
-       background: white;\r
-       border-width: 2px 2px 0;\r
-       border-style: solid;\r
-       border-color: #E0E0E0;\r
-       margin: auto;\r
-}\r
-#header h1\r
-{\r
-       /* small header image specific lines */\r
-       height: 168px;\r
-       width: 692px;\r
-       background: white url(images/header_sm.jpg) repeat-x 0 6px;\r
-       margin: 0 6px;\r
-       /* end small header image specific lines */\r
-       font-size: 38px;\r
-       text-align: center;\r
-       line-height: 160px;\r
-}\r
-\r
-/*-------------------------------------------------\r
-  Content wrappers\r
--------------------------------------------------*/\r
-#mainwrapper\r
-{\r
-       width: 704px;\r
-       background: white;\r
-       border-width: 0 2px;\r
-       border-style: solid;\r
-       border-color: #E0E0E0;\r
-       margin: auto;\r
-}\r
-#wrapper\r
-{\r
-       width: 704px;\r
-       background: white url(images/bgcontainer01.gif) repeat-y;\r
-       margin: auto;\r
-}\r
-\r
-/*-------------------------------------------------\r
-  Main content\r
--------------------------------------------------*/\r
-#container\r
-{\r
-       width: 704px;\r
-       height: 1%;\r
-       overflow: visible;\r
-       float: right;\r
-       padding: 4px 0 0 0;\r
-       margin-left: -204px;\r
-}\r
-.content\r
-{\r
-       padding: 0;\r
-       margin: 7px 20px 30px 224px;\r
-}\r
-\r
-/*-------------------------------------------------\r
-  Item styles\r
--------------------------------------------------*/\r
-.contenttitle h2\r
-{\r
-       clear: both;\r
-       background: url(images/dot.gif) bottom repeat-x;\r
-       font-size: 18px;\r
-       padding: 0 0 6px 0;\r
-       margin: 0;\r
-}\r
-.contentbody\r
-{\r
-       font-size:13px;\r
-       text-align: justify;\r
-       padding: 0 0 16px 0;\r
-}\r
-\r
-/*-------------------------------------------------\r
-  Item info\r
--------------------------------------------------*/\r
-.contentitemcategory\r
-{\r
-       background: url(images/bgcategory.gif) center left no-repeat;\r
-       font-size: 10px;\r
-       line-height: 12px;\r
-       padding: 0 10px 0 14px;\r
-}\r
-.contentitempostedby\r
-{\r
-       background: url(images/bgpostedby.gif) center left no-repeat;\r
-       font-size: 10px;\r
-       line-height: 12px;\r
-       padding: 0 10px 0 12px;\r
-}\r
-.contentitemcomments\r
-{\r
-       background: url(images/bgcomment.gif) center left no-repeat;\r
-       font-size: 10px;\r
-       line-height: 12px;\r
-       padding: 0 10px 0 13px;\r
-}\r
-.contentitemedit\r
-{\r
-       background: url(images/bgedit.gif) center left no-repeat;\r
-       font-size: 10px;\r
-       line-height: 12px;\r
-       padding: 0 10px 0 11px;\r
-}\r
-.contentitem\r
-{\r
-       padding: 3px 0 0 0;\r
-       margin: 0 0 16px 0;\r
-}\r
-.contentitem1\r
-{\r
-       display: inline;\r
-}\r
-.contentitem2\r
-{\r
-       display: inline;\r
-       background: url(images/dotv.gif) left repeat-y;\r
-       padding: 0 0 0 10px;\r
-}\r
-.contentitem3\r
-{\r
-       display: inline;\r
-       background: url(images/dotv.gif) left repeat-y;\r
-       padding: 0 0 0 10px;\r
-}\r
-.contentitem4\r
-{\r
-       display: inline;\r
-       padding: 0 0 0 10px;\r
-       background: url(images/dotv.gif) left repeat-y;\r
-}\r
-\r
-/*-------------------------------------------------\r
-  Comments\r
--------------------------------------------------*/\r
-.itemcomment\r
-{\r
-       background: url(images/commentquote01.gif) no-repeat;\r
-       background-position: 6px 9px;\r
-       padding: 6px 42px;\r
-       border: 1px solid white;\r
-       margin: 10px 0 0 0;\r
-}\r
-.itemcomment:hover\r
-{\r
-       background: #F9F9F9 url(images/commentquote02.gif) no-repeat;\r
-       background-position: 6px 9px;\r
-       border: 1px solid #CCCCCC;\r
-}\r
-.id1 /*This is to give the admin a special comment style, to distinguish him/her from the rest of the commentors*/\r
-{\r
-       background: #F9F9F9 url(images/commentquote02.gif) no-repeat;\r
-       background-position: 6px 9px;\r
-       border: 1px solid #B3C492;\r
-}\r
-.id1:hover\r
-{\r
-       background: #F9F9F9 url(images/commentquote02.gif) no-repeat;\r
-       background-position: 6px 9px;\r
-       border: 1px solid #B3C492;\r
-}\r
-.itemcomment h3\r
-{\r
-       font-size: 12px;\r
-}\r
-\r
-/*-------------------------------------------------\r
-  Menu\r
--------------------------------------------------*/\r
-#sidebarcontainer\r
-{\r
-       float: left;\r
-       width: 204px;\r
-       padding: 2px 0 0 0;\r
-}\r
-.sidebar\r
-{\r
-       color: #21262A;\r
-       margin: 0 0 4px 6px;\r
-}\r
-\r
-/* Menu lists */\r
-.sidebardl\r
-{\r
-       padding: 0 0 10px 0;\r
-       margin: 0;\r
-}\r
-.sidebardl dt\r
-{\r
-       background: #E5E5E5 url(images/sidetitlebg.gif);\r
-       color: #3A3523;\r
-       font-size: 12px;\r
-       font-weight: bold;\r
-    font-family: "Georgia", "Lucida Grande", "Lucida Sans Unicode", Arial, "Trebuchet MS", sans-serif;\r
-       padding: 4px 10px;\r
-}\r
-.sidebardl dd\r
-{\r
-       background: #EEEEEE;\r
-       padding: 2px 10px;\r
-       margin: 1px 0 0 0;\r
-}\r
-.sidebardl dd:hover\r
-{\r
-       background: #E7E7E7;\r
-       padding: 2px 10px;\r
-       margin: 1px 0 0 0;\r
-}\r
-.sidebardl dd a:link, .sidebardl dd a:visited\r
-{\r
-       background: url(images/arrow.gif) left center no-repeat;\r
-       padding: 0 0 0 10px;\r
-}\r
-\r
-/*-------------------------------------------------\r
-  Footer\r
--------------------------------------------------*/\r
-#footer\r
-{\r
-       width: 704px;\r
-       background: #FCD21B;\r
-       text-align: center;\r
-       padding: 10px 0 10px 0;\r
-       border-width: 0px 2px 2px 2px;\r
-       border-style: solid;\r
-       border-color: #E0E0E0;\r
-       margin: 0 auto;\r
-}\r
-\r
-#copyrights\r
-{\r
-       color: #474747;\r
-}\r
-\r
-/*-------------------------------------------------\r
-  Forms\r
--------------------------------------------------*/\r
-.loginform, .searchform\r
-{\r
-       margin: 5px 0;\r
-}\r
-.commentform, .mailform\r
-{\r
-       margin-top: 10px;\r
-    padding: 10px;\r
-    background: #EEEEEE;\r
-    /* Rounded borders, for Mozilla browsers */\r
-    /* -moz-border-radius: 10px; */\r
-}\r
-.commentform img{\r
-    margin: 5px 0 0 0;\r
-}\r
-.formfield\r
-{\r
-       font-size: 11px;\r
-       background: white;\r
-       color: #494949;\r
-       border-top: 1px solid #868686;\r
-       border-left: 1px solid #868686;\r
-       border-bottom: 1px solid #D4D2CF;\r
-       border-right: 1px solid #D4D2CF;\r
-       margin: 1px 0 0 0;\r
-}\r
-.formbutton\r
-{\r
-       font-size: 11px;\r
-       background: white;\r
-       color: #494949;\r
-       border-top: 1px solid #D4D2CF;\r
-       border-left: 1px solid #D4D2CF;\r
-       border-bottom: 1px solid #868686;\r
-       border-right: 1px solid #868686;\r
-       margin: 1px 0 0 0;\r
-}\r
-.searchform .formfield\r
-{\r
-       width: 130px;\r
-    font-family: Arial, Tahoma, Trebuchet MS, Verdana, sans-serif;\r
-       padding: 2px 0;\r
-       margin: 0 2px 2px 0;\r
-}\r
-.searchform .formbutton\r
-{\r
-       width: 60px;\r
-    font-family: Tahoma, Arial, Trebuchet MS, Verdana, sans-serif;\r
-       padding: 2px 2px;\r
-}\r
-.loginform .formfield\r
-{\r
-       width: 130px;\r
-    font-family: Arial, Tahoma, Trebuchet MS, Verdana, sans-serif;\r
-       padding: 2px 0;\r
-       margin: 0 2px 2px 0;\r
-}\r
-.loginform .formbutton\r
-{\r
-       width: 60px;\r
-    font-family: Tahoma, Arial, Trebuchet MS, Verdana, sans-serif;\r
-       padding: 2px 2px;\r
-}\r
-.mainform .formfield\r
-{\r
-       width: 280px;\r
-    font-family: Arial, Tahoma, Trebuchet MS, Verdana, sans-serif;\r
-       padding: 2px 0;\r
-       margin: 0 2px 2px 0;\r
-}\r
-.mailform .formbutton\r
-{\r
-       width: 100px;\r
-    font-family: Tahoma, Arial, Trebuchet MS, Verdana, sans-serif;\r
-       padding: 2px 2px;\r
-}\r
-#nucleus_cf_name, #nucleus_cf_mail\r
-{\r
-    width: 300px;\r
-    margin-right: 105px;\r
-    font-family: Arial, Trebuchet MS, Verdana, sans-serif;\r
-}\r
-.commentform textarea, .commentform .formfield, .mailform textarea, .mailform .formfield\r
-{\r
-    width: 300px;\r
-}\r
-.commentform .formbutton\r
-{\r
-       width: 100px;\r
-       height: 22px;\r
-    font-family: Tahoma, Arial, Trebuchet MS, Verdana, sans-serif;\r
-}\r
-.error\r
-{\r
-       color: red;\r
-       font-weight: bold;\r
-}\r
-\r
-\r
-/*-------------------------------------------------\r
-  Miscelaneous\r
--------------------------------------------------*/\r
-/* VBlog image onion skin shadow - From AListApart.com*/\r
-.wrap1, .wrap2, .wrap3\r
-{\r
-       display:inline-table;\r
-       /* \*/display:block;/**/\r
-}\r
-.wrap1\r
-{\r
-       float:left;\r
-       background:url(images/shadow.gif) right bottom no-repeat;\r
-       margin: 0 5px 3px 0;\r
-}\r
-.wrap2\r
-{\r
-       background:url(images/corner_br.gif) left bottom no-repeat;\r
-}\r
-.wrap3\r
-{\r
-       background:url(images/corner_tr.gif) right top no-repeat;\r
-       padding:0 5px 5px 0;\r
-}\r
-.wrap3 img\r
-{\r
-       display:block;\r
-       border: 3px solid white;\r
-}\r
-\r
-/* Search highlight color */\r
-.highlight\r
-{\r
-       background: #DEFFA9;\r
-}\r
-\r
-/* Leftbox and Rightbox toolbar buttons */\r
-.leftbox, .rightbox {\r
-       margin: 3px;\r
-       padding: 3px;\r
-       font-size: larger;\r
-       width: 20%;\r
-}\r
-.leftbox {\r
-       float: left;\r
-       border-right: 2px solid #ccc;\r
-}\r
-.rightbox {\r
-       float: right;\r
-       border-left: 2px solid #ccc;\r
-}\r
+/*-------------------------------------------------
+  Nucleus CMS Stylesheet - bundled with version 3.2
+  Based on the Stanch skin by Ivan Fong
+  Mods by hcgtv and moraes
+-------------------------------------------------*/
+
+/*-------------------------------------------------
+  General layout
+-------------------------------------------------*/
+body
+{
+       background: #505050 url(images/bg.gif);
+       color: #494949;
+       font-family: "Lucida Grande", "Lucida Sans Unicode", "Trebuchet MS", Trebuchet, Arial, sans-serif;
+       font-size: 11px;
+       padding: 15px 0;
+       margin: 0;
+}
+img
+{
+       border: 0;
+}
+form
+{
+       margin: 0;
+}
+
+/* Headings */
+h1,h2,h3,h4,h5,h6
+{
+    font-family: "Georgia", "Lucida Grande", "Lucida Sans Unicode", "Trebuchet MS", Trebuchet, Arial, sans-serif;
+       font-weight: normal;
+       margin: 0;
+}
+
+/* Lists */
+ul
+{
+       list-style: none;
+       padding: 0;
+       margin: 0;
+}
+li
+{
+       background: url(images/arrow.gif) left 5px no-repeat;
+       padding: 0 0 0 10px;
+       margin: 0 20px;
+}
+
+/* Links */
+a:link, a:visited
+{
+       color: #635D45;
+       text-decoration: none;
+}
+a:hover, a:active
+{
+       color: black;
+}
+#header a:link, #header a:visited
+{
+       color: #474747;
+}
+#header a:hover, #header a:active
+{
+       color: #737373;
+}
+#copyrights a:link, #copyrights a:visited
+{
+       color: #474747;
+}
+#copyrights a:hover, #copyrights a:active
+{
+       color: #737373;
+}
+
+/* Basic classes */
+.hidden
+{
+       display: none;
+}
+.centerize
+{
+       text-align: center;
+}
+.clearing
+{
+       width: 704px;
+       height: 0;
+       clear: both;
+}
+
+/*-------------------------------------------------
+  Header
+-------------------------------------------------*/
+#header
+{
+       position: relative;
+       width: 704px;
+       height: 168px;
+       /* large header image is defined below */
+       /* background: white url(images/header.jpg) no-repeat; */
+       background: white;
+       border-width: 2px 2px 0;
+       border-style: solid;
+       border-color: #E0E0E0;
+       margin: auto;
+}
+#header h1
+{
+       /* small header image specific lines */
+       height: 168px;
+       width: 692px;
+       background: white url(images/header_sm.jpg) repeat-x 0 6px;
+       margin: 0 6px;
+       /* end small header image specific lines */
+       font-size: 38px;
+       text-align: center;
+       line-height: 160px;
+}
+
+/*-------------------------------------------------
+  Content wrappers
+-------------------------------------------------*/
+#mainwrapper
+{
+       width: 704px;
+       background: white;
+       border-width: 0 2px;
+       border-style: solid;
+       border-color: #E0E0E0;
+       margin: auto;
+}
+#wrapper
+{
+       width: 704px;
+       background: white url(images/bgcontainer01.gif) repeat-y;
+       margin: auto;
+}
+
+/*-------------------------------------------------
+  Main content
+-------------------------------------------------*/
+#container
+{
+       width: 704px;
+       height: 1%;
+       overflow: visible;
+       float: right;
+       padding: 4px 0 0 0;
+       margin-left: -204px;
+}
+.content
+{
+       padding: 0;
+       margin: 7px 20px 30px 224px;
+}
+
+/*-------------------------------------------------
+  Item styles
+-------------------------------------------------*/
+.contenttitle h2
+{
+       clear: both;
+       background: url(images/dot.gif) bottom repeat-x;
+       font-size: 18px;
+       padding: 0 0 6px 0;
+       margin: 0;
+}
+.contentbody
+{
+       font-size:13px;
+       text-align: justify;
+       padding: 0 0 16px 0;
+}
+
+/*-------------------------------------------------
+  Item info
+-------------------------------------------------*/
+.contentitemcategory
+{
+       background: url(images/bgcategory.gif) center left no-repeat;
+       font-size: 10px;
+       line-height: 12px;
+       padding: 0 10px 0 14px;
+}
+.contentitempostedby
+{
+       background: url(images/bgpostedby.gif) center left no-repeat;
+       font-size: 10px;
+       line-height: 12px;
+       padding: 0 10px 0 12px;
+}
+.contentitemcomments
+{
+       background: url(images/bgcomment.gif) center left no-repeat;
+       font-size: 10px;
+       line-height: 12px;
+       padding: 0 10px 0 13px;
+}
+.contentitemedit
+{
+       background: url(images/bgedit.gif) center left no-repeat;
+       font-size: 10px;
+       line-height: 12px;
+       padding: 0 10px 0 11px;
+}
+.contentitem
+{
+       padding: 3px 0 0 0;
+       margin: 0 0 16px 0;
+}
+.contentitem1
+{
+       display: inline;
+}
+.contentitem2
+{
+       display: inline;
+       background: url(images/dotv.gif) left repeat-y;
+       padding: 0 0 0 10px;
+}
+.contentitem3
+{
+       display: inline;
+       background: url(images/dotv.gif) left repeat-y;
+       padding: 0 0 0 10px;
+}
+.contentitem4
+{
+       display: inline;
+       padding: 0 0 0 10px;
+       background: url(images/dotv.gif) left repeat-y;
+}
+
+/*-------------------------------------------------
+  Comments
+-------------------------------------------------*/
+.itemcomment
+{
+       background: url(images/commentquote01.gif) no-repeat;
+       background-position: 6px 9px;
+       padding: 6px 42px;
+       border: 1px solid white;
+       margin: 10px 0 0 0;
+}
+.itemcomment:hover
+{
+       background: #F9F9F9 url(images/commentquote02.gif) no-repeat;
+       background-position: 6px 9px;
+       border: 1px solid #CCCCCC;
+}
+.id1 /*This is to give the admin a special comment style, to distinguish him/her from the rest of the commentors*/
+{
+       background: #F9F9F9 url(images/commentquote02.gif) no-repeat;
+       background-position: 6px 9px;
+       border: 1px solid #B3C492;
+}
+.id1:hover
+{
+       background: #F9F9F9 url(images/commentquote02.gif) no-repeat;
+       background-position: 6px 9px;
+       border: 1px solid #B3C492;
+}
+.itemcomment h3
+{
+       font-size: 12px;
+}
+
+/*-------------------------------------------------
+  Menu
+-------------------------------------------------*/
+#sidebarcontainer
+{
+       float: left;
+       width: 204px;
+       padding: 2px 0 0 0;
+}
+.sidebar
+{
+       color: #21262A;
+       margin: 0 0 4px 6px;
+}
+
+/* Menu lists */
+.sidebardl
+{
+       padding: 0 0 10px 0;
+       margin: 0;
+}
+.sidebardl dt
+{
+       background: #E5E5E5 url(images/sidetitlebg.gif);
+       color: #3A3523;
+       font-size: 12px;
+       font-weight: bold;
+    font-family: "Georgia", "Lucida Grande", "Lucida Sans Unicode", Arial, "Trebuchet MS", sans-serif;
+       padding: 4px 10px;
+}
+.sidebardl dd
+{
+       background: #EEEEEE;
+       padding: 2px 10px;
+       margin: 1px 0 0 0;
+}
+.sidebardl dd:hover
+{
+       background: #E7E7E7;
+       padding: 2px 10px;
+       margin: 1px 0 0 0;
+}
+.sidebardl dd a:link, .sidebardl dd a:visited
+{
+       background: url(images/arrow.gif) left center no-repeat;
+       padding: 0 0 0 10px;
+}
+
+/*-------------------------------------------------
+  Footer
+-------------------------------------------------*/
+#footer
+{
+       width: 704px;
+       background: #FCD21B;
+       text-align: center;
+       padding: 10px 0 10px 0;
+       border-width: 0px 2px 2px 2px;
+       border-style: solid;
+       border-color: #E0E0E0;
+       margin: 0 auto;
+}
+
+#copyrights
+{
+       color: #474747;
+}
+
+/*-------------------------------------------------
+  Forms
+-------------------------------------------------*/
+.loginform, .searchform
+{
+       margin: 5px 0;
+}
+.commentform, .mailform
+{
+       margin-top: 10px;
+    padding: 10px;
+    background: #EEEEEE;
+    /* Rounded borders, for Mozilla browsers */
+    /* -moz-border-radius: 10px; */
+}
+.commentform img{
+    margin: 5px 0 0 0;
+}
+.formfield
+{
+       display:block;
+       font-size: 11px;
+       background: white;
+       color: #494949;
+       border-top: 1px solid #868686;
+       border-left: 1px solid #868686;
+       border-bottom: 1px solid #D4D2CF;
+       border-right: 1px solid #D4D2CF;
+       margin: 1px 0 0 0;
+}
+.formbutton
+{
+       font-size: 11px;
+       background: white;
+       color: #494949;
+       border-top: 1px solid #D4D2CF;
+       border-left: 1px solid #D4D2CF;
+       border-bottom: 1px solid #868686;
+       border-right: 1px solid #868686;
+       margin: 1px 0 0 0;
+}
+.commentform .formfield, .commentform .formbutton, .loginform .formbutton {
+       display: block;
+}
+.searchform .formfield
+{
+       width: 130px;
+    font-family: Arial, Tahoma, Trebuchet MS, Verdana, sans-serif;
+       padding: 2px 0;
+       margin: 0 2px 2px 0;
+}
+.searchform .formbutton
+{
+       width: 60px;
+    font-family: Tahoma, Arial, Trebuchet MS, Verdana, sans-serif;
+       padding: 2px 2px;
+}
+.loginform .formfield
+{
+       width: 130px;
+    font-family: Arial, Tahoma, Trebuchet MS, Verdana, sans-serif;
+       padding: 2px 0;
+       margin: 0 2px 2px 0;
+}
+.loginform .formbutton
+{
+       width: 60px;
+    font-family: Tahoma, Arial, Trebuchet MS, Verdana, sans-serif;
+       padding: 2px 2px;
+}
+.mainform .formfield
+{
+       width: 280px;
+    font-family: Arial, Tahoma, Trebuchet MS, Verdana, sans-serif;
+       padding: 2px 0;
+       margin: 0 2px 2px 0;
+}
+.mailform .formbutton
+{
+       width: 100px;
+    font-family: Tahoma, Arial, Trebuchet MS, Verdana, sans-serif;
+       padding: 2px 2px;
+}
+#nucleus_cf_name, #nucleus_cf_mail, #nucleus_cf_email
+{
+    width: 300px;
+    margin-right: 105px;
+    font-family: Arial, Trebuchet MS, Verdana, sans-serif;
+}
+.commentform textarea, .commentform .formfield, .mailform textarea, .mailform .formfield
+{
+    width: 300px;
+}
+.commentform .formbutton
+{
+       width: 100px;
+       height: 22px;
+    font-family: Tahoma, Arial, Trebuchet MS, Verdana, sans-serif;
+}
+.error
+{
+       color: red;
+       font-weight: bold;
+}
+
+
+/*-------------------------------------------------
+  Miscelaneous
+-------------------------------------------------*/
+/* VBlog image onion skin shadow - From AListApart.com*/
+.wrap1, .wrap2, .wrap3
+{
+       display:inline-table;
+       /* \*/display:block;/**/
+}
+.wrap1
+{
+       float:left;
+       background:url(images/shadow.gif) right bottom no-repeat;
+       margin: 0 5px 3px 0;
+}
+.wrap2
+{
+       background:url(images/corner_br.gif) left bottom no-repeat;
+}
+.wrap3
+{
+       background:url(images/corner_tr.gif) right top no-repeat;
+       padding:0 5px 5px 0;
+}
+.wrap3 img
+{
+       display:block;
+       border: 3px solid white;
+}
+
+/* Search highlight color */
+.highlight
+{
+       background: #DEFFA9;
+}
+
+/* Leftbox and Rightbox toolbar buttons */
+.leftbox, .rightbox {
+       margin: 3px;
+       padding: 3px;
+       font-size: larger;
+       width: 20%;
+}
+.leftbox {
+       float: left;
+       border-right: 2px solid #ccc;
+}
+.rightbox {
+       float: right;
+       border-left: 2px solid #ccc;
+}
index ec32e2e..02f3205 100644 (file)
-/*-------------------------------------------------\r
-  Nucleus CMS Stylesheet - bundled with version 3.2\r
-  Based on the Stanch skin by Ivan Fong\r
-  Mods by hcgtv and moraes\r
--------------------------------------------------*/\r
-\r
-/*-------------------------------------------------\r
-  General layout\r
--------------------------------------------------*/\r
-body\r
-{\r
-       background: #505050 url(images/bg.gif);\r
-       color: #494949;\r
-       font-family: "Lucida Grande", "Lucida Sans Unicode", "Trebuchet MS", Trebuchet, Arial, sans-serif;\r
-       font-size: 11px;\r
-       padding: 15px 0;\r
-       margin: 0;\r
-}\r
-img\r
-{\r
-       border: 0;\r
-}\r
-form\r
-{\r
-       margin: 0;\r
-}\r
-\r
-/* Headings */\r
-h1,h2,h3,h4,h5,h6\r
-{\r
-    font-family: "Georgia", "Lucida Grande", "Lucida Sans Unicode", "Trebuchet MS", Trebuchet, Arial, sans-serif;\r
-       font-weight: normal;\r
-       margin: 0;\r
-}\r
-\r
-/* Lists */\r
-ul\r
-{\r
-       list-style: none;\r
-       padding: 0;\r
-       margin: 0;\r
-}\r
-li\r
-{\r
-       background: url(images/arrow.gif) left 5px no-repeat;\r
-       padding: 0 0 0 10px;\r
-       margin: 0 20px;\r
-}\r
-\r
-/* Links */\r
-a:link, a:visited\r
-{\r
-       color: #635D45;\r
-       text-decoration: none;\r
-}\r
-a:hover, a:active\r
-{\r
-       color: black;\r
-}\r
-#header a:link, #header a:visited\r
-{\r
-       color: #474747;\r
-}\r
-#header a:hover, #header a:active\r
-{\r
-       color: #737373;\r
-}\r
-#copyrights a:link, #copyrights a:visited\r
-{\r
-       color: #474747;\r
-}\r
-#copyrights a:hover, #copyrights a:active\r
-{\r
-       color: #737373;\r
-}\r
-\r
-/* Basic classes */\r
-.hidden\r
-{\r
-       display: none;\r
-}\r
-.centerize\r
-{\r
-       text-align: center;\r
-}\r
-.clearing\r
-{\r
-       width: 704px;\r
-       height: 0;\r
-       clear: both;\r
-}\r
-\r
-/*-------------------------------------------------\r
-  Header\r
--------------------------------------------------*/\r
-#header\r
-{\r
-       position: relative;\r
-       width: 704px;\r
-       height: 168px;\r
-       /* large header image is defined below */\r
-       /* background: white url(images/header.jpg) no-repeat; */\r
-       background: white;\r
-       border-width: 2px 2px 0;\r
-       border-style: solid;\r
-       border-color: #E0E0E0;\r
-       margin: auto;\r
-}\r
-#header h1\r
-{\r
-       /* small header image specific lines */\r
-       height: 168px;\r
-       width: 692px;\r
-       background: white url(images/header_sm.jpg) repeat-x 0 6px;\r
-       margin: 0 6px;\r
-       /* end small header image specific lines */\r
-       font-size: 38px;\r
-       text-align: center;\r
-       line-height: 160px;\r
-}\r
-\r
-/*-------------------------------------------------\r
-  Content wrappers\r
--------------------------------------------------*/\r
-#mainwrapper\r
-{\r
-       width: 704px;\r
-       background: white;\r
-       border-width: 0 2px;\r
-       border-style: solid;\r
-       border-color: #E0E0E0;\r
-       margin: auto;\r
-}\r
-#wrapper\r
-{\r
-       width: 704px;\r
-       background: white url(images/bgcontainer02.gif) repeat-y right;\r
-       margin: auto;\r
-}\r
-\r
-/*-------------------------------------------------\r
-  Main content\r
--------------------------------------------------*/\r
-#container\r
-{\r
-       width: 704px;\r
-       height: 1%;\r
-       overflow: visible;\r
-       float: left;\r
-       padding: 4px 0 0 0;\r
-       margin-right: -204px;\r
-}\r
-.content\r
-{\r
-       padding: 0;\r
-       margin: 7px 224px 30px 20px;\r
-}\r
-\r
-/*-------------------------------------------------\r
-  Item styles\r
--------------------------------------------------*/\r
-.contenttitle h2\r
-{\r
-       clear: both;\r
-       background: url(images/dot.gif) bottom repeat-x;\r
-       font-size: 18px;\r
-       padding: 0 0 6px 0;\r
-       margin: 0;\r
-}\r
-.contentbody\r
-{\r
-       font-size:13px;\r
-       text-align: justify;\r
-       padding: 0 0 16px 0;\r
-}\r
-\r
-/*-------------------------------------------------\r
-  Item info\r
--------------------------------------------------*/\r
-.contentitemcategory\r
-{\r
-       background: url(images/bgcategory.gif) center left no-repeat;\r
-       font-size: 10px;\r
-       line-height: 12px;\r
-       padding: 0 10px 0 14px;\r
-}\r
-.contentitempostedby\r
-{\r
-       background: url(images/bgpostedby.gif) center left no-repeat;\r
-       font-size: 10px;\r
-       line-height: 12px;\r
-       padding: 0 10px 0 12px;\r
-}\r
-.contentitemcomments\r
-{\r
-       background: url(images/bgcomment.gif) center left no-repeat;\r
-       font-size: 10px;\r
-       line-height: 12px;\r
-       padding: 0 10px 0 13px;\r
-}\r
-.contentitemedit\r
-{\r
-       background: url(images/bgedit.gif) center left no-repeat;\r
-       font-size: 10px;\r
-       line-height: 12px;\r
-       padding: 0 10px 0 11px;\r
-}\r
-.contentitem\r
-{\r
-       padding: 3px 0 0 0;\r
-       margin: 0 0 16px 0;\r
-}\r
-.contentitem1\r
-{\r
-       display: inline;\r
-}\r
-.contentitem2\r
-{\r
-       display: inline;\r
-       background: url(images/dotv.gif) left repeat-y;\r
-       padding: 0 0 0 10px;\r
-}\r
-.contentitem3\r
-{\r
-       display: inline;\r
-       background: url(images/dotv.gif) left repeat-y;\r
-       padding: 0 0 0 10px;\r
-}\r
-.contentitem4\r
-{\r
-       display: inline;\r
-       padding: 0 0 0 10px;\r
-       background: url(images/dotv.gif) left repeat-y;\r
-}\r
-\r
-/*-------------------------------------------------\r
-  Comments\r
--------------------------------------------------*/\r
-.itemcomment\r
-{\r
-       background: url(images/commentquote01.gif) no-repeat;\r
-       background-position: 6px 9px;\r
-       padding: 6px 42px;\r
-       border: 1px solid white;\r
-       margin: 10px 0 0 0;\r
-}\r
-.itemcomment:hover\r
-{\r
-       background: #F9F9F9 url(images/commentquote02.gif) no-repeat;\r
-       background-position: 6px 9px;\r
-       border: 1px solid #CCCCCC;\r
-}\r
-.id1 /*This is to give the admin a special comment style, to distinguish him/her from the rest of the commentors*/\r
-{\r
-       background: #F9F9F9 url(images/commentquote02.gif) no-repeat;\r
-       background-position: 6px 9px;\r
-       border: 1px solid #B3C492;\r
-}\r
-.id1:hover\r
-{\r
-       background: #F9F9F9 url(images/commentquote02.gif) no-repeat;\r
-       background-position: 6px 9px;\r
-       border: 1px solid #B3C492;\r
-}\r
-.itemcomment h3\r
-{\r
-       font-size: 12px;\r
-}\r
-\r
-/*-------------------------------------------------\r
-  Menu\r
--------------------------------------------------*/\r
-#sidebarcontainer\r
-{\r
-       float: right;\r
-       width: 204px;\r
-       padding: 2px 0 0 0;\r
-}\r
-.sidebar\r
-{\r
-       color: #21262A;\r
-       margin: 0 6px 4px 0;\r
-}\r
-\r
-/* Menu lists */\r
-.sidebardl\r
-{\r
-       padding: 0 0 10px 0;\r
-       margin: 0;\r
-}\r
-.sidebardl dt\r
-{\r
-       background: #E5E5E5 url(images/sidetitlebg.gif);\r
-       color: #3A3523;\r
-       font-size: 12px;\r
-       font-weight: bold;\r
-    font-family: "Georgia", "Lucida Grande", "Lucida Sans Unicode", Arial, "Trebuchet MS", sans-serif;\r
-       padding: 4px 10px;\r
-}\r
-.sidebardl dd\r
-{\r
-       background: #EEEEEE;\r
-       padding: 2px 10px;\r
-       margin: 1px 0 0 0;\r
-}\r
-.sidebardl dd:hover\r
-{\r
-       background: #E7E7E7;\r
-       padding: 2px 10px;\r
-       margin: 1px 0 0 0;\r
-}\r
-.sidebardl dd a:link, .sidebardl dd a:visited\r
-{\r
-       background: url(images/arrow.gif) left center no-repeat;\r
-       padding: 0 0 0 10px;\r
-}\r
-\r
-/*-------------------------------------------------\r
-  Footer\r
--------------------------------------------------*/\r
-#footer\r
-{\r
-       width: 704px;\r
-       background: #FCD21B;\r
-       text-align: center;\r
-       padding: 10px 0 10px 0;\r
-       border-width: 0px 2px 2px 2px;\r
-       border-style: solid;\r
-       border-color: #E0E0E0;\r
-       margin: 0 auto;\r
-}\r
-\r
-#copyrights\r
-{\r
-       color: #474747;\r
-}\r
-\r
-/*-------------------------------------------------\r
-  Forms\r
--------------------------------------------------*/\r
-.loginform, .searchform\r
-{\r
-       margin: 5px 0;\r
-}\r
-.commentform, .mailform\r
-{\r
-       margin-top: 10px;\r
-    padding: 10px;\r
-    background: #EEEEEE;\r
-    /* Rounded borders, for Mozilla browsers */\r
-    /* -moz-border-radius: 10px; */\r
-}\r
-.commentform img{\r
-    margin: 5px 0 0 0;\r
-}\r
-.formfield\r
-{\r
-       font-size: 11px;\r
-       background: white;\r
-       color: #494949;\r
-       border-top: 1px solid #868686;\r
-       border-left: 1px solid #868686;\r
-       border-bottom: 1px solid #D4D2CF;\r
-       border-right: 1px solid #D4D2CF;\r
-       margin: 1px 0 0 0;\r
-}\r
-.formbutton\r
-{\r
-       font-size: 11px;\r
-       background: white;\r
-       color: #494949;\r
-       border-top: 1px solid #D4D2CF;\r
-       border-left: 1px solid #D4D2CF;\r
-       border-bottom: 1px solid #868686;\r
-       border-right: 1px solid #868686;\r
-       margin: 1px 0 0 0;\r
-}\r
-.searchform .formfield\r
-{\r
-       width: 130px;\r
-    font-family: Arial, Tahoma, Trebuchet MS, Verdana, sans-serif;\r
-       padding: 2px 0;\r
-       margin: 0 2px 2px 0;\r
-}\r
-.searchform .formbutton\r
-{\r
-       width: 60px;\r
-    font-family: Tahoma, Arial, Trebuchet MS, Verdana, sans-serif;\r
-       padding: 2px 2px;\r
-}\r
-.loginform .formfield\r
-{\r
-       width: 130px;\r
-    font-family: Arial, Tahoma, Trebuchet MS, Verdana, sans-serif;\r
-       padding: 2px 0;\r
-       margin: 0 2px 2px 0;\r
-}\r
-.loginform .formbutton\r
-{\r
-       width: 60px;\r
-    font-family: Tahoma, Arial, Trebuchet MS, Verdana, sans-serif;\r
-       padding: 2px 2px;\r
-}\r
-.mainform .formfield\r
-{\r
-       width: 280px;\r
-    font-family: Arial, Tahoma, Trebuchet MS, Verdana, sans-serif;\r
-       padding: 2px 0;\r
-       margin: 0 2px 2px 0;\r
-}\r
-.mailform .formbutton\r
-{\r
-       width: 100px;\r
-    font-family: Tahoma, Arial, Trebuchet MS, Verdana, sans-serif;\r
-       padding: 2px 2px;\r
-}\r
-#nucleus_cf_name, #nucleus_cf_mail\r
-{\r
-    width: 300px;\r
-    margin-right: 105px;\r
-    font-family: Arial, Trebuchet MS, Verdana, sans-serif;\r
-}\r
-.commentform textarea, .commentform .formfield, .mailform textarea, .mailform .formfield\r
-{\r
-    width: 300px;\r
-}\r
-.commentform .formbutton\r
-{\r
-       width: 100px;\r
-       height: 22px;\r
-    font-family: Tahoma, Arial, Trebuchet MS, Verdana, sans-serif;\r
-}\r
-.error\r
-{\r
-       color: red;\r
-       font-weight: bold;\r
-}\r
-\r
-\r
-/*-------------------------------------------------\r
-  Miscelaneous\r
--------------------------------------------------*/\r
-/* VBlog image onion skin shadow - From AListApart.com*/\r
-.wrap1, .wrap2, .wrap3\r
-{\r
-       display:inline-table;\r
-       /* \*/display:block;/**/\r
-}\r
-.wrap1\r
-{\r
-       float:left;\r
-       background:url(images/shadow.gif) right bottom no-repeat;\r
-       margin: 0 5px 3px 0;\r
-}\r
-.wrap2\r
-{\r
-       background:url(images/corner_br.gif) left bottom no-repeat;\r
-}\r
-.wrap3\r
-{\r
-       background:url(images/corner_tr.gif) right top no-repeat;\r
-       padding:0 5px 5px 0;\r
-}\r
-.wrap3 img\r
-{\r
-       display:block;\r
-       border: 3px solid white;\r
-}\r
-\r
-/* Search highlight color */\r
-.highlight\r
-{\r
-       background: #DEFFA9;\r
-}\r
-\r
-/* Leftbox and Rightbox toolbar buttons */\r
-.leftbox, .rightbox {\r
-       margin: 3px;\r
-       padding: 3px;\r
-       font-size: larger;\r
-       width: 20%;\r
-}\r
-.leftbox {\r
-       float: left;\r
-       border-right: 2px solid #ccc;\r
-}\r
-.rightbox {\r
-       float: right;\r
-       border-left: 2px solid #ccc;\r
-}\r
+/*-------------------------------------------------
+  Nucleus CMS Stylesheet - bundled with version 3.2
+  Based on the Stanch skin by Ivan Fong
+  Mods by hcgtv and moraes
+-------------------------------------------------*/
+
+/*-------------------------------------------------
+  General layout
+-------------------------------------------------*/
+body
+{
+       background: #505050 url(images/bg.gif);
+       color: #494949;
+       font-family: "Lucida Grande", "Lucida Sans Unicode", "Trebuchet MS", Trebuchet, Arial, sans-serif;
+       font-size: 11px;
+       padding: 15px 0;
+       margin: 0;
+}
+img
+{
+       border: 0;
+}
+form
+{
+       margin: 0;
+}
+
+/* Headings */
+h1,h2,h3,h4,h5,h6
+{
+    font-family: "Georgia", "Lucida Grande", "Lucida Sans Unicode", "Trebuchet MS", Trebuchet, Arial, sans-serif;
+       font-weight: normal;
+       margin: 0;
+}
+
+/* Lists */
+ul
+{
+       list-style: none;
+       padding: 0;
+       margin: 0;
+}
+li
+{
+       background: url(images/arrow.gif) left 5px no-repeat;
+       padding: 0 0 0 10px;
+       margin: 0 20px;
+}
+
+/* Links */
+a:link, a:visited
+{
+       color: #635D45;
+       text-decoration: none;
+}
+a:hover, a:active
+{
+       color: black;
+}
+#header a:link, #header a:visited
+{
+       color: #474747;
+}
+#header a:hover, #header a:active
+{
+       color: #737373;
+}
+#copyrights a:link, #copyrights a:visited
+{
+       color: #474747;
+}
+#copyrights a:hover, #copyrights a:active
+{
+       color: #737373;
+}
+
+/* Basic classes */
+.hidden
+{
+       display: none;
+}
+.centerize
+{
+       text-align: center;
+}
+.clearing
+{
+       width: 704px;
+       height: 0;
+       clear: both;
+}
+
+/*-------------------------------------------------
+  Header
+-------------------------------------------------*/
+#header
+{
+       position: relative;
+       width: 704px;
+       height: 168px;
+       /* large header image is defined below */
+       /* background: white url(images/header.jpg) no-repeat; */
+       background: white;
+       border-width: 2px 2px 0;
+       border-style: solid;
+       border-color: #E0E0E0;
+       margin: auto;
+}
+#header h1
+{
+       /* small header image specific lines */
+       height: 168px;
+       width: 692px;
+       background: white url(images/header_sm.jpg) repeat-x 0 6px;
+       margin: 0 6px;
+       /* end small header image specific lines */
+       font-size: 38px;
+       text-align: center;
+       line-height: 160px;
+}
+
+/*-------------------------------------------------
+  Content wrappers
+-------------------------------------------------*/
+#mainwrapper
+{
+       width: 704px;
+       background: white;
+       border-width: 0 2px;
+       border-style: solid;
+       border-color: #E0E0E0;
+       margin: auto;
+}
+#wrapper
+{
+       width: 704px;
+       background: white url(images/bgcontainer02.gif) repeat-y right;
+       margin: auto;
+}
+
+/*-------------------------------------------------
+  Main content
+-------------------------------------------------*/
+#container
+{
+       width: 704px;
+       height: 1%;
+       overflow: visible;
+       float: left;
+       padding: 4px 0 0 0;
+       margin-right: -204px;
+}
+.content
+{
+       padding: 0;
+       margin: 7px 224px 30px 20px;
+}
+
+/*-------------------------------------------------
+  Item styles
+-------------------------------------------------*/
+.contenttitle h2
+{
+       clear: both;
+       background: url(images/dot.gif) bottom repeat-x;
+       font-size: 18px;
+       padding: 0 0 6px 0;
+       margin: 0;
+}
+.contentbody
+{
+       font-size:13px;
+       text-align: justify;
+       padding: 0 0 16px 0;
+}
+
+/*-------------------------------------------------
+  Item info
+-------------------------------------------------*/
+.contentitemcategory
+{
+       background: url(images/bgcategory.gif) center left no-repeat;
+       font-size: 10px;
+       line-height: 12px;
+       padding: 0 10px 0 14px;
+}
+.contentitempostedby
+{
+       background: url(images/bgpostedby.gif) center left no-repeat;
+       font-size: 10px;
+       line-height: 12px;
+       padding: 0 10px 0 12px;
+}
+.contentitemcomments
+{
+       background: url(images/bgcomment.gif) center left no-repeat;
+       font-size: 10px;
+       line-height: 12px;
+       padding: 0 10px 0 13px;
+}
+.contentitemedit
+{
+       background: url(images/bgedit.gif) center left no-repeat;
+       font-size: 10px;
+       line-height: 12px;
+       padding: 0 10px 0 11px;
+}
+.contentitem
+{
+       padding: 3px 0 0 0;
+       margin: 0 0 16px 0;
+}
+.contentitem1
+{
+       display: inline;
+}
+.contentitem2
+{
+       display: inline;
+       background: url(images/dotv.gif) left repeat-y;
+       padding: 0 0 0 10px;
+}
+.contentitem3
+{
+       display: inline;
+       background: url(images/dotv.gif) left repeat-y;
+       padding: 0 0 0 10px;
+}
+.contentitem4
+{
+       display: inline;
+       padding: 0 0 0 10px;
+       background: url(images/dotv.gif) left repeat-y;
+}
+
+/*-------------------------------------------------
+  Comments
+-------------------------------------------------*/
+.itemcomment
+{
+       background: url(images/commentquote01.gif) no-repeat;
+       background-position: 6px 9px;
+       padding: 6px 42px;
+       border: 1px solid white;
+       margin: 10px 0 0 0;
+}
+.itemcomment:hover
+{
+       background: #F9F9F9 url(images/commentquote02.gif) no-repeat;
+       background-position: 6px 9px;
+       border: 1px solid #CCCCCC;
+}
+.id1 /*This is to give the admin a special comment style, to distinguish him/her from the rest of the commentors*/
+{
+       background: #F9F9F9 url(images/commentquote02.gif) no-repeat;
+       background-position: 6px 9px;
+       border: 1px solid #B3C492;
+}
+.id1:hover
+{
+       background: #F9F9F9 url(images/commentquote02.gif) no-repeat;
+       background-position: 6px 9px;
+       border: 1px solid #B3C492;
+}
+.itemcomment h3
+{
+       font-size: 12px;
+}
+
+/*-------------------------------------------------
+  Menu
+-------------------------------------------------*/
+#sidebarcontainer
+{
+       float: right;
+       width: 204px;
+       padding: 2px 0 0 0;
+}
+.sidebar
+{
+       color: #21262A;
+       margin: 0 6px 4px 0;
+}
+
+/* Menu lists */
+.sidebardl
+{
+       padding: 0 0 10px 0;
+       margin: 0;
+}
+.sidebardl dt
+{
+       background: #E5E5E5 url(images/sidetitlebg.gif);
+       color: #3A3523;
+       font-size: 12px;
+       font-weight: bold;
+    font-family: "Georgia", "Lucida Grande", "Lucida Sans Unicode", Arial, "Trebuchet MS", sans-serif;
+       padding: 4px 10px;
+}
+.sidebardl dd
+{
+       background: #EEEEEE;
+       padding: 2px 10px;
+       margin: 1px 0 0 0;
+}
+.sidebardl dd:hover
+{
+       background: #E7E7E7;
+       padding: 2px 10px;
+       margin: 1px 0 0 0;
+}
+.sidebardl dd a:link, .sidebardl dd a:visited
+{
+       background: url(images/arrow.gif) left center no-repeat;
+       padding: 0 0 0 10px;
+}
+
+/*-------------------------------------------------
+  Footer
+-------------------------------------------------*/
+#footer
+{
+       width: 704px;
+       background: #FCD21B;
+       text-align: center;
+       padding: 10px 0 10px 0;
+       border-width: 0px 2px 2px 2px;
+       border-style: solid;
+       border-color: #E0E0E0;
+       margin: 0 auto;
+}
+
+#copyrights
+{
+       color: #474747;
+}
+
+/*-------------------------------------------------
+  Forms
+-------------------------------------------------*/
+.loginform, .searchform
+{
+       margin: 5px 0;
+}
+.commentform, .mailform
+{
+       margin-top: 10px;
+    padding: 10px;
+    background: #EEEEEE;
+    /* Rounded borders, for Mozilla browsers */
+    /* -moz-border-radius: 10px; */
+}
+.commentform img{
+    margin: 5px 0 0 0;
+}
+.formfield
+{
+       display:block;
+       font-size: 11px;
+       background: white;
+       color: #494949;
+       border-top: 1px solid #868686;
+       border-left: 1px solid #868686;
+       border-bottom: 1px solid #D4D2CF;
+       border-right: 1px solid #D4D2CF;
+       margin: 1px 0 0 0;
+}
+.formbutton
+{
+       font-size: 11px;
+       background: white;
+       color: #494949;
+       border-top: 1px solid #D4D2CF;
+       border-left: 1px solid #D4D2CF;
+       border-bottom: 1px solid #868686;
+       border-right: 1px solid #868686;
+       margin: 1px 0 0 0;
+}
+.commentform .formfield, .commentform .formbutton, .loginform .formbutton {
+       display: block;
+}
+.searchform .formfield
+{
+       width: 130px;
+    font-family: Arial, Tahoma, Trebuchet MS, Verdana, sans-serif;
+       padding: 2px 0;
+       margin: 0 2px 2px 0;
+}
+.searchform .formbutton
+{
+       width: 60px;
+    font-family: Tahoma, Arial, Trebuchet MS, Verdana, sans-serif;
+       padding: 2px 2px;
+}
+.loginform .formfield
+{
+       width: 130px;
+    font-family: Arial, Tahoma, Trebuchet MS, Verdana, sans-serif;
+       padding: 2px 0;
+       margin: 0 2px 2px 0;
+}
+.loginform .formbutton
+{
+       width: 60px;
+    font-family: Tahoma, Arial, Trebuchet MS, Verdana, sans-serif;
+       padding: 2px 2px;
+}
+.mainform .formfield
+{
+       width: 280px;
+    font-family: Arial, Tahoma, Trebuchet MS, Verdana, sans-serif;
+       padding: 2px 0;
+       margin: 0 2px 2px 0;
+}
+.mailform .formbutton
+{
+       width: 100px;
+    font-family: Tahoma, Arial, Trebuchet MS, Verdana, sans-serif;
+       padding: 2px 2px;
+}
+#nucleus_cf_name, #nucleus_cf_mail, #nucleus_cf_email
+{
+    width: 300px;
+    margin-right: 105px;
+    font-family: Arial, Trebuchet MS, Verdana, sans-serif;
+}
+.commentform textarea, .commentform .formfield, .mailform textarea, .mailform .formfield
+{
+    width: 300px;
+}
+.commentform .formbutton
+{
+       width: 100px;
+       height: 22px;
+    font-family: Tahoma, Arial, Trebuchet MS, Verdana, sans-serif;
+}
+.error
+{
+       color: red;
+       font-weight: bold;
+}
+
+
+/*-------------------------------------------------
+  Miscelaneous
+-------------------------------------------------*/
+/* VBlog image onion skin shadow - From AListApart.com*/
+.wrap1, .wrap2, .wrap3
+{
+       display:inline-table;
+       /* \*/display:block;/**/
+}
+.wrap1
+{
+       float:left;
+       background:url(images/shadow.gif) right bottom no-repeat;
+       margin: 0 5px 3px 0;
+}
+.wrap2
+{
+       background:url(images/corner_br.gif) left bottom no-repeat;
+}
+.wrap3
+{
+       background:url(images/corner_tr.gif) right top no-repeat;
+       padding:0 5px 5px 0;
+}
+.wrap3 img
+{
+       display:block;
+       border: 3px solid white;
+}
+
+/* Search highlight color */
+.highlight
+{
+       background: #DEFFA9;
+}
+
+/* Leftbox and Rightbox toolbar buttons */
+.leftbox, .rightbox {
+       margin: 3px;
+       padding: 3px;
+       font-size: larger;
+       width: 20%;
+}
+.leftbox {
+       float: left;
+       border-right: 2px solid #ccc;
+}
+.rightbox {
+       float: right;
+       border-left: 2px solid #ccc;
+}
index 282842f..0f4e021 100644 (file)
@@ -1,36 +1,36 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"\r
-"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
-\r
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja-JP" lang="ja-JP">\r
-<head>\r
-<meta http-equiv="Content-Type" content="text/html; charset=EUC-JP" />\r
-\r
-<!-- meta information for search engines -->\r
-<meta name="generator" content="<%version%>" />\r
-<meta name="name" content="<%blogsetting(name)%>" />\r
-<meta name="description" content="<%blogsetting(desc)%>" />\r
-\r
-<!-- prevent caching (can be removed) -->\r
-<meta http-equiv="Pragma" content="no-cache" />\r
-<meta http-equiv="Cache-Control" content="no-cache, must-revalidate" />\r
-<meta http-equiv="Expires" content="-1" />\r
-\r
-<!-- site stylesheet (site colors and layout definitions) -->\r
-<link rel="stylesheet" type="text/css" href="<%skinfile(default_right.css)%>" />\r
-\r
-<!-- tooltips & stylesheet (activated by title="" on links) -->\r
-<link rel="stylesheet" type="text/css" href="<%skinfile(nicetitle.css)%>" />\r
-<script type="text/javascript" src="<%skinfile(nicetitle.js)%>"></script>\r
-\r
-<!-- RSS 2.0 feed -->\r
-<link rel="alternate" type="application/rss+xml" title="RSS" href="xml-rss2.php" />\r
-\r
-<!-- RSD support -->\r
-<link rel="EditURI" type="application/rsd+xml" title="RSD" href="rsd.php" />\r
-\r
-<!-- favorite icon -->\r
-<link rel="shortcut icon" href="/favicon.ico" />\r
-<link rel="icon" href="/favicon.ico" />\r
-\r
-<!-- navigation & page titles -->\r
-<%parsedinclude(navigation.inc)%>\r
+<!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="ja-JP" lang="ja-JP">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=EUC-JP" />
+
+<!-- meta information for search engines -->
+<meta name="generator" content="<%version%>" />
+<meta name="name" content="<%if(skintype,error)%><%sitevar(name)%><%else%><%blogsetting(name)%><%endif%>" />
+<meta name="description" content="<%if(skintype,error)%><%sitevar(name)%><%else%><%blogsetting(desc)%><%endif%>" />
+
+<!-- prevent caching (can be removed) -->
+<meta http-equiv="Pragma" content="no-cache" />
+<meta http-equiv="Cache-Control" content="no-cache, must-revalidate" />
+<meta http-equiv="Expires" content="-1" />
+
+<!-- site stylesheet (site colors and layout definitions) -->
+<link rel="stylesheet" type="text/css" href="<%skinfile(default_right.css)%>" />
+
+<!-- tooltips & stylesheet (activated by title="" on links) -->
+<link rel="stylesheet" type="text/css" href="<%skinfile(nicetitle.css)%>" />
+<script type="text/javascript" src="<%skinfile(nicetitle.js)%>"></script>
+
+<!-- RSS 2.0 feed -->
+<link rel="alternate" type="application/rss+xml" title="RSS" href="xml-rss2.php" />
+
+<!-- RSD support -->
+<link rel="EditURI" type="application/rsd+xml" title="RSD" href="rsd.php" />
+
+<!-- favorite icon -->
+<link rel="shortcut icon" href="/favicon.ico" />
+<link rel="icon" href="/favicon.ico" />
+
+<!-- navigation & page titles -->
+<%parsedinclude(navigation.inc)%>
index 81628b2..169f70a 100644 (file)
@@ -1,56 +1,56 @@
-<!-- archive: page title and extra navigational links -->\r
-<%if(skintype,archive)%>\r
-<title><%blogsetting(name)%> &raquo; Archive</title>\r
-<link rel="archives" title="Archives" href="<%archivelink%>" />\r
-<link rel="top" title="Today" href="<%sitevar(url)%>" />\r
-<link rel="up" href="<%todaylink%>" title="Today" />\r
-<%endif%>\r
-\r
-<!-- archivelist: page title and extra navigational links -->\r
-<%if(skintype,archivelist)%>\r
-<title><%blogsetting(name)%> &raquo; Archive List</title>\r
-<link rel="archives" title="Archives" href="<%archivelink%>" />\r
-<link rel="top" title="Today" href="<%sitevar(url)%>" />\r
-<link rel="up" href="<%todaylink%>" title="Today" />\r
-<%endif%>\r
-\r
-<!-- error: page title and extra navigational links -->\r
-<%if(skintype,error)%>\r
-<title><%sitevar(name)%> &raquo; Error!</title>\r
-<link rel="top" title="Today" href="<%todaylink%>" />\r
-<link rel="up" href="<%todaylink%>" title="Today" />\r
-<%endif%>\r
-\r
-<!-- index: page title and extra navigational links -->\r
-<%if(skintype,index)%>\r
-<title><%blogsetting(name)%></title>\r
-<link rel="bookmark" title="Nucleus" href="http://nucleuscms.org/" />\r
-<link rel="archives" title="Archives" href="<%archivelink%>" />\r
-<link rel="top" title="Today" href="<%todaylink%>" />\r
-<%endif%>\r
-\r
-<!-- item: page title and extra navigational links -->\r
-<%if(skintype,item)%>\r
-<title><%blogsetting(name)%> &raquo; <%itemtitle%></title>\r
-<link rel="archives" title="Archives" href="<%archivelink%>" />\r
-<link rel="top" title="Today" href="<%sitevar(url)%>" />\r
-<link rel="next" href="<%nextlink%>" title="Next Item" />\r
-<link rel="prev" href="<%prevlink%>" title="Previous Item" />\r
-<link rel="up" href="<%todaylink%>" title="Today" />\r
-<%endif%>\r
-\r
-<!-- member: page title and extra navigational links -->\r
-<%if(skintype,member)%>\r
-<title><%blogsetting(name)%> &raquo; Member Details</title>\r
-<link rel="top" title="Today" href="<%todaylink%>" />\r
-<link rel="up" href="<%todaylink%>" title="Today" />\r
-<%endif%>\r
-\r
-<!-- search: page title and extra navigational links -->\r
-<%if(skintype,search)%>\r
-<title><%blogsetting(name)%> &raquo; Search</title>\r
-<link rel="archives" title="Archives" href="<%archivelink%>" />\r
-<link rel="top" title="Today" href="<%sitevar(url)%>" />\r
-<link rel="up" href="<%todaylink%>" title="Today" />\r
-<%endif%>\r
+<!-- archive: page title and extra navigational links -->
+<%if(skintype,archive)%>
+<title><%blogsetting(name)%> &raquo; Archive</title>
+<link rel="archives" title="Archives" href="<%archivelink%>" />
+<link rel="top" title="Today" href="<%sitevar(url)%>" />
+<link rel="up" href="<%todaylink%>" title="Today" />
+<%endif%>
+
+<!-- archivelist: page title and extra navigational links -->
+<%if(skintype,archivelist)%>
+<title><%blogsetting(name)%> &raquo; Archive List</title>
+<link rel="archives" title="Archives" href="<%archivelink%>" />
+<link rel="top" title="Today" href="<%sitevar(url)%>" />
+<link rel="up" href="<%todaylink%>" title="Today" />
+<%endif%>
+
+<!-- error: page title and extra navigational links -->
+<%if(skintype,error)%>
+<title><%sitevar(name)%> &raquo; Error!</title>
+<link rel="top" title="Today" href="<%todaylink%>" />
+<link rel="up" href="<%todaylink%>" title="Today" />
+<%endif%>
+
+<!-- index: page title and extra navigational links -->
+<%if(skintype,index)%>
+<title><%blogsetting(name)%></title>
+<link rel="bookmark" title="Nucleus" href="http://nucleuscms.org/" />
+<link rel="archives" title="Archives" href="<%archivelink%>" />
+<link rel="top" title="Today" href="<%todaylink%>" />
+<%endif%>
+
+<!-- item: page title and extra navigational links -->
+<%if(skintype,item)%>
+<title><%blogsetting(name)%> &raquo; <%itemtitle(attribute)%></title>
+<link rel="archives" title="Archives" href="<%archivelink%>" />
+<link rel="top" title="Today" href="<%sitevar(url)%>" />
+<link rel="next" href="<%nextlink%>" title="Next Item" />
+<link rel="prev" href="<%prevlink%>" title="Previous Item" />
+<link rel="up" href="<%todaylink%>" title="Today" />
+<%endif%>
+
+<!-- member: page title and extra navigational links -->
+<%if(skintype,member)%>
+<title><%blogsetting(name)%> &raquo; Member Details</title>
+<link rel="top" title="Today" href="<%todaylink%>" />
+<link rel="up" href="<%todaylink%>" title="Today" />
+<%endif%>
+
+<!-- search: page title and extra navigational links -->
+<%if(skintype,search)%>
+<title><%blogsetting(name)%> &raquo; Search</title>
+<link rel="archives" title="Archives" href="<%archivelink%>" />
+<link rel="top" title="Today" href="<%sitevar(url)%>" />
+<link rel="up" href="<%todaylink%>" title="Today" />
+<%endif%>
 </head>
\ No newline at end of file
index 50cc02c..8d9e065 100755 (executable)
@@ -1,65 +1,72 @@
-<?php\r
-\r
-/**\r
-  * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/) \r
-  * Copyright (C) 2002-2005 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
-  * Nucleus RSS syndication channel skin\r
-  */\r
-\r
-header("Pragma: no-cache");\r
-\r
-$CONF = array();\r
-$CONF['Self'] = "xml-rss2.php";\r
-\r
-include('./config.php');\r
-\r
-if (!$CONF['DisableSite']) {\r
-       // get feed into $feed\r
-       ob_start();\r
-               selectSkin('feeds/rss20');\r
-               selector();\r
-       $feed = ob_get_contents();\r
-       ob_end_clean();\r
-       \r
-       // create ETAG (hash of feed)\r
-       // (HTTP_IF_NONE_MATCH has quotes around it)\r
-       $eTag = '"'.md5($feed).'"';\r
-       header('Etag: '.$eTag);\r
-       \r
-       // compare Etag to what we got\r
-       if ($eTag == serverVar('HTTP_IF_NONE_MATCH')) { \r
-               header("HTTP/1.0 304 Not Modified");\r
-               header('Content-Length: 0');\r
-       } else {\r
-               $feed = mb_convert_encoding($feed, "UTF-8", "EUC-JP");\r
-               header("Content-Type: application/xml");\r
-               // dump feed\r
-               echo $feed;\r
-       }\r
-               \r
-} else {\r
-       // output empty RSS file...\r
-       // (because site is disabled)\r
-       \r
-       echo '<' . '?xml version="1.0" encoding="ISO-8859-1"?' . '>';\r
-       \r
-       ?>\r
-       <rss version="2.0">\r
-         <channel>\r
-           <title><?php echo htmlspecialchars($CONF['SiteName'])?></title>\r
-           <link><?php echo htmlspecialchars($CONF['IndexURL'])?></link>\r
-           <description></description>\r
-           <docs>http://backend.userland.com/rss</docs>\r
-         </channel>\r
-       </rss>  \r
-       <?php\r
-}\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)
+ */
+
+/**
+ * Nucleus RSS syndication channel skin
+ * @license http://nucleuscms.org/license.txt GNU General Public License
+ * @copyright Copyright (C) 2002-2007 The Nucleus Group
+ * @version $Id: xml-rss2.php,v 1.5 2007-03-22 09:23:50 kimitake Exp $
+ * $NucleusJP: xml-rss2.php,v 1.8 2007/02/04 06:28:44 kimitake Exp $
+ */
+
+header('Pragma: no-cache');
+
+$CONF = array();
+$CONF['Self'] = 'xml-rss2.php';
+
+include('./config.php');
+
+if (!$CONF['DisableSite']) {
+
+       // get feed into $feed
+       ob_start();
+       selectSkin('feeds/rss20');
+       selector();
+       $feed = ob_get_contents();
+       ob_end_clean();
+
+       // create ETAG (hash of feed)
+       // (HTTP_IF_NONE_MATCH has quotes around it)
+       $eTag = '"' . md5($feed) . '"';
+       header('Etag: ' . $eTag);
+
+       // compare Etag to what we got
+       if ($eTag == serverVar('HTTP_IF_NONE_MATCH') ) {
+               header('HTTP/1.0 304 Not Modified');
+               header('Content-Length: 0');
+       } else {
+               $feed = mb_convert_encoding($feed, "UTF-8", "EUC-JP");
+               header("Content-Type: application/xml");
+               // dump feed
+               echo $feed;
+       }
+
+} else {
+       // output empty RSS file...
+       // (because site is disabled)
+
+       echo '<' . '?xml version="1.0" encoding="' . _CHARSET . '"?' . '>';
+
+       ?>
+       <rss version="2.0">
+               <channel>
+                       <title><?php echo htmlspecialchars($CONF['SiteName']); ?></title>
+                       <link><?php echo htmlspecialchars($CONF['IndexURL']); ?></link>
+                       <description></description>
+                       <docs>http://backend.userland.com/rss</docs>
+               </channel>
+       </rss>
+       <?php
+}
+
+?>
\ No newline at end of file