OSDN Git Service

merged v3.22
authorkimitake <kimitake@1ca29b6e-896d-4ea0-84a5-967f57386b96>
Thu, 25 Aug 2005 07:04:15 +0000 (07:04 +0000)
committerkimitake <kimitake@1ca29b6e-896d-4ea0-84a5-967f57386b96>
Thu, 25 Aug 2005 07:04:15 +0000 (07:04 +0000)
git-svn-id: https://svn.sourceforge.jp/svnroot/nucleus-jp/nucleus-jp/branches/branch-3-2@120 1ca29b6e-896d-4ea0-84a5-967f57386b96

59 files changed:
euc/nucleus/libs/ADMIN.php
utf8/action.php
utf8/atom.php
utf8/extra/fancyurls/archive
utf8/extra/fancyurls/archives
utf8/extra/fancyurls/blog
utf8/extra/fancyurls/category
utf8/extra/fancyurls/fancyurls.config.php
utf8/extra/fancyurls/item
utf8/extra/fancyurls/member
utf8/install.php
utf8/install.sql
utf8/nucleus/bookmarklet.php
utf8/nucleus/forms/additemform.template
utf8/nucleus/forms/loginform-loggedin.template
utf8/nucleus/forms/loginform-notloggedin.template
utf8/nucleus/index.php
utf8/nucleus/libs/ACTION.php
utf8/nucleus/libs/ACTIONLOG.php
utf8/nucleus/libs/ADMIN.php
utf8/nucleus/libs/BAN.php
utf8/nucleus/libs/BLOG.php
utf8/nucleus/libs/COMMENT.php
utf8/nucleus/libs/COMMENTS.php
utf8/nucleus/libs/ITEM.php
utf8/nucleus/libs/KARMA.php
utf8/nucleus/libs/MANAGER.php
utf8/nucleus/libs/MEDIA.php
utf8/nucleus/libs/MEMBER.php
utf8/nucleus/libs/NOTIFICATION.php
utf8/nucleus/libs/PAGEFACTORY.php
utf8/nucleus/libs/PARSER.php
utf8/nucleus/libs/PLUGIN.php
utf8/nucleus/libs/PLUGINADMIN.php
utf8/nucleus/libs/SEARCH.php
utf8/nucleus/libs/SKIN.php
utf8/nucleus/libs/TEMPLATE.php
utf8/nucleus/libs/backup.php
utf8/nucleus/libs/globalfunctions.php
utf8/nucleus/libs/skinie.php
utf8/nucleus/libs/vars4.0.6.php
utf8/nucleus/libs/vars4.1.0.php
utf8/nucleus/libs/xmlrpc.inc.php
utf8/nucleus/media.php
utf8/nucleus/plugins/NP_SkinFiles.php
utf8/nucleus/plugins/skinfiles/dir.gif
utf8/nucleus/plugins/skinfiles/image.gif
utf8/nucleus/plugins/skinfiles/index.php
utf8/nucleus/plugins/skinfiles/php.gif
utf8/nucleus/plugins/skinfiles/text.gif
utf8/nucleus/xmlrpc/api_blogger.inc.php
utf8/nucleus/xmlrpc/api_metaweblog.inc.php
utf8/nucleus/xmlrpc/api_mt.inc.php
utf8/nucleus/xmlrpc/api_nucleus.inc.php
utf8/nucleus/xmlrpc/server.php
utf8/skins/atom/skinbackup.xml
utf8/skins/rsd/skinbackup.xml
utf8/skins/rss2.0/skinbackup.xml
utf8/xml-rss2.php

index fae5dac..aff11cb 100755 (executable)
@@ -14,8 +14,8 @@
   *\r
  * @license http://nucleuscms.org/license.txt GNU General Public License\r
  * @copyright Copyright (C) 2002-2005 The Nucleus Group\r
- * @version $Id: ADMIN.php,v 1.6.2.3 2005-08-23 08:08:37 kimitake Exp $\r
- * @version $NucleusJP: ADMIN.php,v 1.6.2.2 2005/07/01 06:38:25 kimitake Exp $\r
+ * @version $Id: ADMIN.php,v 1.6.2.4 2005-08-25 07:03:55 kimitake Exp $\r
+ * @version $NucleusJP: ADMIN.php,v 1.6.2.3 2005/08/23 08:08:37 kimitake Exp $\r
   */\r
 \r
 class ADMIN {\r
@@ -5368,7 +5368,6 @@ selector();
 \r
                // update all events\r
                $this->action_pluginupdate();\r
-\r
        }\r
 \r
        function action_pluginupdate() {\r
index de6628e..fcdab80 100755 (executable)
@@ -1,5 +1,5 @@
 <?php\r
-/*\r
+/*\r
   * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/) \r
   * Copyright (C) 2002-2005 The Nucleus Group\r
   *\r
@@ -8,11 +8,15 @@
   * as published by the Free Software Foundation; either version 2\r
   * of the License, or (at your option) any later version.\r
   * (see nucleus/documentation/index.html#license for more info)  \r
-  *\r
+ */\r
+\r
+/**\r
   * File containing actions that can be performed by visitors of the site,\r
   * like adding comments, etc...\r
-  *\r
-  * $Id: action.php,v 1.4 2005-03-12 06:19:03 kimitake Exp $\r
+ * @license http://nucleuscms.org/license.txt GNU General Public License\r
+ * @copyright Copyright (C) 2002-2005 The Nucleus Group\r
+ * @version $Id: action.php,v 1.4.2.1 2005-08-25 07:04:13 kimitake Exp $\r
+ * @version $NucleusJP$\r
   */\r
 \r
 $CONF = array();\r
@@ -29,4 +33,4 @@ if ($errorInfo)
        doError($errorInfo['message'], new SKIN($errorInfo['skinid'])); \r
 }\r
 \r
-?>
\ No newline at end of file
+?>\r
index cd9c0d3..d98bcdd 100755 (executable)
@@ -1,6 +1,6 @@
 <?php\r
 \r
-/**\r
+/*\r
   * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/) \r
   * Copyright (C) 2002-2005 The Nucleus Group\r
   *\r
@@ -9,8 +9,14 @@
   * as published by the Free Software Foundation; either version 2\r
   * of the License, or (at your option) any later version.\r
   * (see nucleus/documentation/index.html#license for more info)\r
-  *\r
+ */\r
+\r
+/**\r
   * Nucleus Atom Syndication\r
+ * @license http://nucleuscms.org/license.txt GNU General Public License\r
+ * @copyright Copyright (C) 2002-2005 The Nucleus Group\r
+ * @version $Id: atom.php,v 1.4.2.1 2005-08-25 07:04:13 kimitake Exp $\r
+ * @version $NucleusJP$\r
   */\r
 \r
 header("Pragma: no-cache");\r
index a37827f..6bc4479 100755 (executable)
@@ -3,9 +3,17 @@
 include('./fancyurls.config.php');\r
 include('./config.php');\r
 \r
-$data = explode("/",serverVar('PATH_INFO'));\r
-$blogid = intval($data[1]);\r
-$archive = $data[2];\r
+// default to default implementation (/archive/1/2005-12)\r
+// if blogid was not filled out by plugins\r
+if (($blogid == 0) && ($archive == ''))\r
+{\r
+       $data = explode("/",serverVar('PATH_INFO'));\r
+       if (count($data) > 2)\r
+       {\r
+               $blogid = intval($data[1]);\r
+               $archive = $data[2];\r
+       }\r
+}\r
 \r
 selector();\r
 \r
index 5c36175..63c1b33 100755 (executable)
@@ -3,8 +3,16 @@
 include('./fancyurls.config.php');\r
 include('./config.php');\r
 \r
-$data = explode("/",serverVar('PATH_INFO'));\r
-$archivelist = intval($data[1]);\r
+// default to default implementation (/archives/1)\r
+// if archivelist was not filled out by plugins\r
+if ($archivelist == 0)\r
+{\r
+       $data = explode("/",serverVar('PATH_INFO'));\r
+       if (count($data) > 1)\r
+       {\r
+               $archivelist = intval($data[1]);\r
+       }\r
+}\r
 \r
 selector();\r
 \r
index 99f6351..32fec13 100755 (executable)
@@ -3,8 +3,16 @@
 include('./fancyurls.config.php');\r
 include('./config.php');\r
 \r
-$data = explode("/",serverVar('PATH_INFO'));\r
-$blogid = intval($data[1]);\r
+// default to default implementation (/blog/1234)\r
+// if blogid was not filled out by plugins\r
+if ($blogid == 0)\r
+{\r
+       $data = explode("/",serverVar('PATH_INFO'));\r
+       if (count($data) > 1)\r
+       {\r
+               $blogid = intval($data[1]);\r
+       }\r
+}\r
 \r
 selector();\r
 \r
index eacbe4d..df7fe6b 100755 (executable)
@@ -3,8 +3,16 @@
 include('./fancyurls.config.php');\r
 include('./config.php');\r
 \r
-$data = explode("/",serverVar('PATH_INFO'));\r
-$catid = intval($data[1]);\r
+// default to default implementation (/category/1234)\r
+// if catid was not filled out by plugins\r
+if ($catid == 0)\r
+{\r
+       $data = explode("/",serverVar('PATH_INFO'));\r
+       if (count($data) > 1)\r
+       {\r
+               $catid = intval($data[1]);\r
+       }\r
+}\r
 \r
 selector();\r
 \r
index 6a8ea9f..70a0efc 100755 (executable)
@@ -1,7 +1,8 @@
-<?\r
+<?php\r
        /*\r
                About\r
                -----\r
+               \r
                This directory contains extra files to make the 'fancy urls' feature even more\r
                fancier, by eliminating the 'index.php'-part of the URL\r
        \r
                   that old one first, and copy the contents of the new .htaccess file (from the fancyurls\r
                   folder) in your old one, and upload that... \r
 \r
-               2. Edit this file so that $CONF['Self'] points to your main directory. \r
+               2. Edit fancyurls.config.php so that $CONF['Self'] points to your main directory. \r
                        NOTE: this time, and only this time, the URL should NOT end in a slash\r
 \r
-               3. Also edit the $CONF['Self'] variable in your index.php, if you don't want to\r
-                  end up with index.php/item/1234 urls when people come via that way\r
+               3. Edit index.php to look like this: \r
+                  \r
+                       $CONF = array();\r
+\r
+                       include('./fancyurls.config.php'); \r
+                       include('./config.php');\r
 \r
+                       selector();\r
+                       \r
                4. Enable 'Fancy URLs' in the Nucleus admin area (nucleus management / edit settings)\r
 \r
                5. Off you go!\r
        \r
        // remember: this URL should _NOT_ end with a slash. \r
        $CONF['Self'] = 'http://www.yourhost.com/yourpath';\r
-       \r
+\r
+    /*\r
+       Advanced: keywords to use in fancy URLs. \r
+       \r
+       If you want to change these, you'll also need to rename the stub files \r
+       and update the contents of the .htaccess file accordingly\r
+    */\r
+    $CONF['ItemKey'] = 'item';\r
+    $CONF['ArchiveKey'] = 'archive';\r
+    $CONF['ArchivesKey'] = 'archives';\r
+    $CONF['MemberKey'] = 'member';\r
+    $CONF['BlogKey'] = 'blog';\r
+    $CONF['CategoryKey'] = 'category'; \r
 ?>
\ No newline at end of file
index 27b1f15..f6e59e6 100755 (executable)
@@ -3,8 +3,16 @@
 include('./fancyurls.config.php');\r
 include('./config.php');\r
 \r
-$data = explode("/",serverVar('PATH_INFO'));\r
-$itemid = intval($data[1]);\r
+// default to default implementation (/item/1234)\r
+// if itemid was not filled out by plugins\r
+if ($itemid == 0)\r
+{\r
+       $data = explode("/",serverVar('PATH_INFO'));\r
+       if (count($data) > 1)\r
+       {\r
+               $itemid = intval($data[1]);\r
+       }\r
+}\r
 \r
 selector();\r
 \r
index 96c3add..147e0fe 100755 (executable)
@@ -3,8 +3,16 @@
 include('./fancyurls.config.php');\r
 include('./config.php');\r
 \r
-$data = explode("/",serverVar('PATH_INFO'));\r
-$memberid = intval($data[1]);\r
+// default to default implementation (/member/1234)\r
+// if memberid was not filled out by plugins\r
+if ($memberid == 0)\r
+{\r
+       $data = explode("/",serverVar('PATH_INFO'));\r
+       if (count($data) > 1)\r
+       {\r
+               $memberid = intval($data[1]);\r
+       }\r
+}\r
 \r
 selector();\r
 \r
index c6e0927..8337912 100755 (executable)
@@ -1,5 +1,5 @@
 <?php\r
-       /**\r
+       /*\r
          * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
          * Copyright (C) 2002-2005 The Nucleus Group\r
          *\r
          * those tables.\r
          *\r
          * Below is a friendly way of letting users on non-php systems know that Nucleus won't run there.\r
-         *\r
-         * ?><div style="font-size: xx-large;">If you see this text in your browser when you open <i>install.php</i>, your web server is not able to run PHP-scripts, and therefor Nucleus will not be able to run there. </div><div style="display: none"><?php         */\r
+        * ?><div style="font-size: xx-large;">If you see this text in your browser when you open <i>install.php</i>, your web server is not able to run PHP-scripts, and therefor Nucleus will not be able to run there. </div><div style="display: none"><?php          \r
+        */\r
+       /**\r
+        * @license http://nucleuscms.org/license.txt GNU General Public License\r
+        * @copyright Copyright (C) 2002-2005 The Nucleus Group\r
+        * @version $Id: install.php,v 1.4.2.1 2005-08-25 07:04:13 kimitake Exp $\r
+        * @version $NucleusJP$\r
+        */\r
 \r
        /*\r
                This part of the install.php code allows for customization of the install process.\r
index 97c0ffa..91e8948 100755 (executable)
@@ -108,7 +108,7 @@ INSERT INTO `nucleus_config` VALUES ('BaseSkin', '5');
 INSERT INTO `nucleus_config` VALUES ('SkinsURL', 'http://localhost:8080/nucleus/skins/');\r
 INSERT INTO `nucleus_config` VALUES ('ActionURL', 'http://localhost:8080/nucleus/action.php');\r
 INSERT INTO `nucleus_config` VALUES ('URLMode', 'normal');\r
-INSERT INTO `nucleus_config` VALUES ('DatabaseVersion', '310');\r
+INSERT INTO `nucleus_config` VALUES ('DatabaseVersion', '322');\r
 \r
 CREATE TABLE `nucleus_item` (\r
   `inumber` int(11) NOT NULL auto_increment,\r
@@ -129,7 +129,7 @@ CREATE TABLE `nucleus_item` (
   FULLTEXT KEY `ibody` (`ibody`,`ititle`,`imore`)\r
 ) TYPE=MyISAM PACK_KEYS=0;\r
 \r
-INSERT INTO `nucleus_item` VALUES (1, 'Nucleus CMS バージョン3.2へようこそ', 'ウェブページの作成を補助する積み木がここにあります。それは心躍るblogになるかもしれませんし、観るものを和ませる家族のページになるかもしれませんし、実り多き趣味のサイトになるかもしれません。あるいは現在のあなたには想像がつかないものになることだってあるでしょう。<br />\r\n<br />\r\n用途が思いつきませんでしたか? それならここへ来て正解です、なぜならあなた同様私たちにもわからないのですから。', '<b>Read Me</b><br />\r\n<br />\r\nこれはサイトにおける最初のエントリーです。スタートを切りやすいように、リンクと情報を入れておきました。<br />\r\n<br />\r\nこの記事を削除することもできますが、どちらにせよ記事を追加していくことによってやがてメインページからは見えなくなります。Nucleusを扱ううちに生じたメモをコメントとして追加し、将来アクセスできるようにこのページをブックマークしておくのも手です。<br />\r\n<br />\r\n<b>リンク</b><br />\r\n<br />\r\nNucleus CMSの<a href="http://nucleuscms.org">本家</a>と<a href="http://japan.nucleuscms.org">日本語公式</a>ページ。<br />\r\n<br />\r\nNucleus CMSのSourceForge<a href="http://sourceforge.net/projects/nucleuscms/">プロジェクト</a>ページ。<br />\r\n<br />\r\nNucleus CMSのプラグイン<a href="http://wakka.xiffy.nl/Plugin/">倉庫</a>と<a href="http://japan.nucleuscms.org/wakka/CategorizedPlugin">日本語のリスト</a>ページ。<br />\r\n<br />\r\n<b>ドキュメント - <a href="http://docs.nucleuscms.org/">docs.nucleuscms.org</a></b><br />\r\n<br />\r\nNucleusの<a href="http://japan.nucleuscms.org/faq.php">FAQ(よくある質問集)</a>(<a href="http://nucleuscms.org/faq.php">原文</a>)ページ。<br />\r\n<br />\r\nインストール方法等は<a href="nucleus/documentation/">ユーザー向け</a>と<a href="nucleus/documentation/devdocs/">開発者向け</a>文書がファイルに含まれています。<br />\r\n<br />\r\nポップアップ<a href="./nucleus/documentation/help.html">ヘルプ</a>が管理エリアのいたるところにあり、サイトのカスタマイズやデザインを手助けしてくれることでしょう。<br />\r\n<br />\r\n一度用意されているドキュメントに目を通したら、<a href="http://wiki.nucleuscms.org/">Wiki</a>(<a href="http://japan.nucleuscms.org/wakka/Nucleus">日本版</a>)を訪れてください。ユーザーの書いたハウツーや小技が掲載されています。<br />\r\n<br />\r\n<b>サポート</b><br />\r\n<br />\r\n<a href="http://forum.nucleuscms.org/">forum.nucleuscms.org</a>(本家)<br />\r\n<a href="http://japan.nucleuscms.org/bb/">japan.nucleuscms.org/bb/</a>(日本版)<br />\r\n<br />\r\n<a href="http://forum.nucleuscms.org/groupcp.php?g=3">moderators</a>とサポートフォーラムで活動する全てのボランティアに感謝します。<br />\r\n<br />\r\n- <a href="http://edmondhui.homeip.net/blog/">admun</a> - Ottawa, ON, Canada               <br />\r\n- <a href="http://www.tamizhan.com/">anand</a> - Bangalore, India<br />\r\n- <a href="http://hcgtv.com">hcgtv</a> - Miami, Florida, USA<br />\r\n- <a href="http://www.adrenalinsports.nl/">ikeizer</a> - Maastricht<br />\r\n- <a href="http://www.tipos.com.br/">moraes</a> - Brazil<br />\r\n- <a href="http://roelg.nl/">roel </a>- The Netherlands<br />\r\n- <a href="http://budts.be/weblog/">TeRanEX </a>- Ekeren, Antwerp, Belgium<br />\r\n- <a href="http://www.trentadams.com/">Trent </a>- Alberta, Canada<br />\r\n- <a href="http://xiffy.nl/weblog/">xiffy </a>- Deventer<br />\r\n<br />\r\nもし手助けが必要なら、1400を超える登録ユーザーのいる私たちのフォーラムに参加してください。23,000を超える投稿された記事を検索できるようになっておりますので、求める答えに数回のクリックでたどり着けるかもしれません。<br />\r\n<br />\r\n<b>Personalization - <a href="http://skins.nucleuscms.org/">skins.nucleuscms.org</a></b><br />\r\n<br />\r\nマルチウェブログとスキン/テンプレートの組み合わせは強力な相乗効果を生み出します。個人的なサイト作成、友人や親戚あるいはクライアントに対するサイトデザインいずれに対してもです。<br />\r\n<br />\r\n636の登録された<a href="http://nucleuscms.org/sites.php">Nucleusで運用されているサイト</a>(<a href="http://japan.nucleuscms.org/sites.php">日本版</a>)の中から特色あるサイトをサンプルとしてご紹介します。<br />\r\n<br />\r\nThe Zen of Nucleus<br />\r\n- <a href="http://beefcake.nl/">beefcake.nl</a> - Beefcake | Nuke the whales!<br />\r\n- <a href="http://www.leng-lui.com//">leng-lui.com</a> - Leng-Lui.com - v7.0: "Memento"<br />\r\n<br />\r\nPersonal blogs<br />\r\n- <a href="http://bloggard.com/">bloggard.com</a> - The Adventures of Bloggard<br />\r\n- <a href="http://battleangel.org/">battleangel.org</a> - Giving meaning to the meaningless<br />\r\n- <a href="http://www.yetanotherblog.de/">yetanotherblog.de</a> - Yet Another Blog<br />\r\n<br />\r\nMulti user blogs<br />\r\n- <a href="http://tipos.com.br/">tipos.com.br</a> - Blogging community<br />\r\n<br />\r\nHobby, Travel and News sites<br />\r\n- <a href="http://adrenalinsports.nl/">adrenalinsports.nl</a> - Extreme sports<br />\r\n- <a href="http://hsbluebird.com/">hsbluebird.com</a> - Hot Springs, Montana''s Online Resource <br />\r\n- <a href="http://groningen-info.de/">groningen-info.de</a> - Neues aus Groningen. Fr Leute aus Duitsland.<br />\r\n- <a href="http://www.americandaily.com/">americandaily.com</a> - American Daily - Home<br />\r\n<br />\r\n<b>Nucleus Developer Network - <a href="http://dev.nucleuscms.org/">dev.nucleuscms.org</a></b><br />\r\n<br />\r\nThe NUDN is a hub for developer sites and programming resources.<br />\r\n<br />\r\nNUDN satellite sites, handles, location and UTC offset:<br />\r\n- <a href="http://karma.nucleuscms.org/">karma</a> - Izegem +02<br />\r\n- <a href="http://hcgtv.net/">hcgtv</a> - Miami -05<br />\r\n- <a href="http://edmondhui.homeip.net/blog/nudn.php">admun</a> - Ottawa -04<br />\r\n- <a href="http://dev.budts.be/nucleus/">TeRanEX</a> - Ekeren +02<br />\r\n<br />\r\nSourceforge.net graciously hosts our <a href="http://sourceforge.net/projects/nucleuscms/">CVS repository</a>.<br />\r\n<br />\r\nWant to play around or test changes, visit our demo site at <a href="http://demo.nucleuscms.org/">demo.nucleuscms.org</a>.<br />\r\n<br />\r\nNot sure what plugins to use, visit the <a href="http://showcase.trentadams.com/">showcase site</a> where you can see plugins at play in their native habitat.<br />\r\n<br />\r\nThen visit the plugin repository at <a href="http://plugins.nucleuscms.org/">plugins.nucleuscms.org</a> for download and installation instructions.<br />\r\n<br />\r\n<b>寄付者一覧</b><br />\r\n<br />\r\n以下の<a href="http://nucleuscms.org/donators.php">素晴らしい人々</a>による<a href="http://nucleuscms.org/donate.php">援助</a>感謝を捧げます。<em>ありがとう!</em><br />\r\n<br />\r\n- <a href="http://reddustrec.net/">dkex</a><br />\r\n- <a href="http://www.uncoverthenet.com/">Uncover the Net</a><br />\r\n- <a href="http://www.webatlas.org/">Web Atlas</a><br />\r\n- <a href="http://www.ipnlighting.com/">IPN Lighting</a><br />\r\n- <a href="http://blog.datoka.jp/">Yu (blog.datoka.jp)</a><br />\r\n- <a href="http://www.thegadgetreview.com/">Sony Gadgets and Reviews</a><br />\r\n- <a href="http://sites.proliphus.com/blueZhift/blog/">Thomas McKibben</a><br />\r\n- <a href="http://cheapweb.us/">CheapWeb.us</a><br />\r\n- Robert Seyfriedsberger<br />\r\n- <a href="http://www.toxicologie.nl/">Toxicologie.nl</a><br />\r\n- Gordon Shum<br />\r\n- <a href="http://www.subsim.com/">Neal Stevens</a><br />\r\n- <a href="http://www.GamblingHelper.com/">GamblingHelper</a><br />\r\n- Oliver Kirstein<br />\r\n- <a href="http://www.dominiek.be/">Dominiek</a><br />\r\n- <a href="http://www.aardschok.net/">Aardschok</a><br />\r\n- <a href="http://www.nieuwevoordeur.be/">nieuwevoordeur.be</a><br />\r\n- <a href="http://www.scene24.net/">Scene24</a><br />\r\n- <a href="http://www.eug.be/">Eug''s Weblog</a><br />\r\n- <a href="http://www.bloggard.com/">The Adventures of Bloggard</a><br />\r\n- <a href="http://www.voltos.com/">Arthur Cronos from Voltos</a><br />\r\n- <a href="http://www.webmaster-toolkit.com/">Free Webmaster Tools and Resources</a><br />\r\n- <a href="http://www.domilog.be/">Domi''s Weblog</a><br />\r\n- Infodoma          <br />\r\n- <a href="http://carvingcode.com/">carvingCode.com</a><br />\r\n- <a href="http://www.traweb.com/">Traweb</a><br />\r\n- <a href="http://gene.mm2u.com/">Gene''s MoBlog</a><br />\r\n- <a href="http://interfacethis.com/">InterfaceThis</a><br />\r\n- <a href="http://www.thefinsters.com/flog/">The Finster Log</a><br />\r\n- <a href="http://www.mrhop.com/">Hop Nguyen</a><br />\r\n- <a href="http://www.zwavel.com/~zwavelaars" title="Zwavelaars">Zwavelaars</a><br />\r\n- <a href="http://beefcake.nl/">Joaquin Scholten</a>      <br />\r\n- <a href="http://www.roelgroeneveld.com/">Roel Groeneveld</a><br />\r\n- <a href="http://lvb.net/">LVBlog</a><br />\r\n- <a href="http://xandermol.com/">Xander Mol</a><br />\r\n- Danilo Massa<br />\r\n- <a href="http://01FTP.com/">01FTP.com</a><br />\r\n- <a href="http://www.adrenalinsports.nl/">Irmo Keizer</a><br />\r\n- <a href="http://www.jasonkrogh.com/">Jason Krogh</a><br />\r\n- <a href="http://www.higuchi.com/">Osamu Higuchi</a><br />\r\n- <a href="http://www.trentadams.com/">Trent Adams</a><br />\r\n- <a href="http://www.ppcw.net/">Arne Hess</a><br />\r\n- <a href="http://hsbluebird.com/">The Bluebird</a><br />\r\n- Rainer Bickel<br />\r\n- Fritz Elfers<br />\r\n- <a href="http://www.european-wall-tapestries.com/">European Wall Tapestries</a><br />\r\n- <a href="http://www.jamier.net/">Jamie R. Rytlewski</a><br />\r\n- Madolyn Piper<br />\r\n- <a href="http://www.batteryvalues.com/">Battery Values</a><br />\r\n- <a href="http://www.mixburnrip.de/">Janko Roettgers</a><br />\r\n- Lukas Loesche<br />\r\n- <a href="http://www.seobook.com/">SEO Book</a><br />\r\n- <a href="http://www.brandweerdematen.nl/">Brandweer de Maten</a><br />\r\n- Andy Fuchs<br />\r\n- <a href="http://www.sumoforce.com/">Sumoforce</a><br />\r\n- <a href="http://love.silverindigo.com/">Al''ky''mie</a><br />\r\n- <a href="http://www.pejo.us/">Peter Johnson</a><br />\r\n- <a href="http://www.triv.nl/">TriV Internet Solutions</a><br />\r\n- <a href="http://www.torontomusicians.org/nucleus/">Margaret Stowe</a><br />\r\n- <a href="http://www.zenkey.org/">zenkey dot org</a><br />\r\n- <a href="http://www.golb.org/">Blots of Info</a><br />\r\n- <a href="http://www.zonderpartij.be/">Rudi De Kerpel</a><br />\r\n- <a href="http://staylorx.com/">Steve Taylor</a><br />\r\n- <a href="http://lmhcave.com/">Malcolm Farnsworth</a><br />\r\n- Birgit Kellner<br />\r\n- <a href="http://www.tobiasly.com/">Toby Johnson</a><br />\r\n- <a href="http://www.kapingamarangi.be/">Kapingamarangi</a><br />\r\n- <a href="http://www.pallalink.net/">Pallalink</a><br />\r\n- <a href="http://publiustx.net/">PubliusTX Weblog</a><br />\r\n- <a href="http://www.reductioadabsurdum.net/">Reductio Ad Absurdum</a><br />\r\n- <a href="http://www.gagaweb.org/">GagaWeb</a><br />\r\n- <a href="http://www.videokid.be/">Videokid</a><br />\r\n- Jon Marr<br />\r\n- <a href="http://www.docblog.org/">Luigi Cristiano</a><br />\r\n- J Keith Lehman<br />\r\n- Bohemian Cachet<br />\r\n- Jesus Mourazos<br />\r\n- <a href="http://ltp-design.com/">Stephen Jones</a><br />\r\n- <a href="http://oha.nu/">One-Handed Apps</a><br />\r\n- Alwin Hawkins<br />\r\n- <a href="http://jstigall.bloomington.in.us">Justin Stigall</a><br />\r\n- <a href="http://www.itismylife.com/">It is my life</a><br />\r\n- Greg Morrill<br />\r\n- <a href="http://www.dutchsubmarines.com/">Dutch Submarines</a><br />\r\n- <a href="http://www.7thwatch.com/">Seventh Watch Design Studios</a>                <br />\r\n- <a href="http://www.macnet2.com/">MacNetv2</a>      <br />\r\n- Richard Noordhof<br />\r\n- <a href="http://www.jamier.net/">Jamie Rytlewski</a><br />\r\n<br />\r\nNucleusが気に入りましたか? <a href="http://www.hotscripts.com/Detailed/13368.html?RID=nucleus@demuynck.org">HotScripts</a>や<a href="http://www.opensourcecms.com/index.php?option=content&task=view&id=145">opensourceCMS<a>での投票をお願いします。<br />\r\n<br />\r\n<b>ライセンス</b><br />\r\n<br />\r\n私たちがフリー・ソフトウェアについて口にする場合は自由のことに言及しているのであって、価格のことではありません。私たちの<a href="http://www.gnu.org/licenses/gpl.html">一般公有使用許諾書</a>(<a href="http://www.gnu.org/licenses/gpl.ja.html">日本語訳</a>と<a href="http://www.atmarkit.co.jp/aig/03linux/gpl.html">概要</a>)は、フリー・ソフトウェアの複製物を自由に頒布できること(そして、望むならこのサービスに対して対価を請求できること)、ソース・コードを実際に受け取るか希望しさえすれば入手することが可能であること、入手したソフトウェアを変更したり新しいフリー・プログラムの一部として使用できること、以上の各内容を行なうことができるということをユーザ自身が知っていることを実現できるようにデザインされています。', 1, 1, '2005-02-16 22:57:54', 0, 0, 0, 1, 0);\r
+INSERT INTO `nucleus_item` VALUES (1, 'Nucleus CMS バージョン3.22へようこそ', 'ウェブページの作成を補助する積み木がここにあります。それは心躍るblogになるかもしれませんし、観るものを和ませる家族のページになるかもしれませんし、実り多き趣味のサイトになるかもしれません。あるいは現在のあなたには想像がつかないものになることだってあるでしょう。<br />\r\n<br />\r\n用途が思いつきませんでしたか? それならここへ来て正解です、なぜならあなた同様私たちにもわからないのですから。', '<b>Read Me</b><br />\r\n<br />\r\nこれはサイトにおける最初のエントリーです。スタートを切りやすいように、リンクと情報を入れておきました。<br />\r\n<br />\r\nこの記事を削除することもできますが、どちらにせよ記事を追加していくことによってやがてメインページからは見えなくなります。Nucleusを扱ううちに生じたメモをコメントとして追加し、将来アクセスできるようにこのページをブックマークしておくのも手です。<br />\r\n<br />\r\n<b>リンク</b><br />\r\n<br />\r\nNucleus CMSの<a href="http://nucleuscms.org">本家</a>と<a href="http://japan.nucleuscms.org">日本語公式</a>ページ。<br />\r\n<br />\r\nNucleus CMSのSourceForge<a href="http://sourceforge.net/projects/nucleuscms/">プロジェクト</a>ページ。<br />\r\n<br />\r\nNucleus CMSのプラグイン<a href="http://wakka.xiffy.nl/Plugin/">倉庫</a>と<a href="http://japan.nucleuscms.org/wakka/CategorizedPlugin">日本語のリスト</a>ページ。<br />\r\n<br />\r\n<b>ドキュメント - <a href="http://docs.nucleuscms.org/">docs.nucleuscms.org</a></b><br />\r\n<br />\r\nNucleusの<a href="http://japan.nucleuscms.org/faq.php">FAQ(よくある質問集)</a>(<a href="http://nucleuscms.org/faq.php">原文</a>)ページ。<br />\r\n<br />\r\nインストール方法等は<a href="nucleus/documentation/">ユーザー向け</a>と<a href="nucleus/documentation/devdocs/">開発者向け</a>文書がファイルに含まれています。<br />\r\n<br />\r\nポップアップ<a href="./nucleus/documentation/help.html">ヘルプ</a>が管理エリアのいたるところにあり、サイトのカスタマイズやデザインを手助けしてくれることでしょう。<br />\r\n<br />\r\n一度用意されているドキュメントに目を通したら、<a href="http://wiki.nucleuscms.org/">Wiki</a>(<a href="http://japan.nucleuscms.org/wakka/Nucleus">日本版</a>)を訪れてください。ユーザーの書いたハウツーや小技が掲載されています。<br />\r\n<br />\r\n<b>サポート</b><br />\r\n<br />\r\n<a href="http://forum.nucleuscms.org/">forum.nucleuscms.org</a>(本家)<br />\r\n<a href="http://japan.nucleuscms.org/bb/">japan.nucleuscms.org/bb/</a>(日本版)<br />\r\n<br />\r\n<a href="http://forum.nucleuscms.org/groupcp.php?g=3">moderators</a>とサポートフォーラムで活動する全てのボランティアに感謝します。<br />\r\n<br />\r\n- <a href="http://edmondhui.homeip.net/blog/">admun</a> - Ottawa, ON, Canada              <br />\r\n- <a href="http://www.tamizhan.com/">anand</a> - Bangalore, India<br />\r\n- <a href="http://hcgtv.com">hcgtv</a> - Miami, Florida, USA<br />\r\n- <a href="http://www.adrenalinsports.nl/">ikeizer</a> - Maastricht<br />\r\n- <a href="http://www.tipos.com.br/">moraes</a> - Brazil<br />\r\n- <a href="http://roelg.nl/">roel </a>- The Netherlands<br />\r\n- <a href="http://budts.be/weblog/">TeRanEX </a>- Ekeren, Antwerp, Belgium<br />\r\n- <a href="http://www.trentadams.com/">Trent </a>- Alberta, Canada<br />\r\n- <a href="http://xiffy.nl/weblog/">xiffy </a>- Deventer<br />\r\n<br />\r\nもし手助けが必要なら、1400を超える登録ユーザーのいる私たちのフォーラムに参加してください。23,000を超える投稿された記事を検索できるようになっておりますので、求める答えに数回のクリックでたどり着けるかもしれません。<br />\r\n<br />\r\n<b>Personalization - <a href="http://skins.nucleuscms.org/">skins.nucleuscms.org</a></b><br />\r\n<br />\r\nマルチウェブログとスキン/テンプレートの組み合わせは強力な相乗効果を生み出します。個人的なサイト作成、友人や親戚あるいはクライアントに対するサイトデザインいずれに対してもです。<br />\r\n<br />\r\n636の登録された<a href="http://nucleuscms.org/sites.php">Nucleusで運用されているサイト</a>(<a href="http://japan.nucleuscms.org/sites.php">日本版</a>)の中から特色あるサイトをサンプルとしてご紹介します。<br />\r\n<br />\r\nThe Zen of Nucleus<br />\r\n- <a href="http://beefcake.nl/">beefcake.nl</a> - Beefcake | Nuke the whales!<br />\r\n- <a href="http://www.leng-lui.com//">leng-lui.com</a> - Leng-Lui.com - v7.0: "Memento"<br />\r\n<br />\r\nPersonal blogs<br />\r\n- <a href="http://bloggard.com/">bloggard.com</a> - The Adventures of Bloggard<br />\r\n- <a href="http://battleangel.org/">battleangel.org</a> - Giving meaning to the meaningless<br />\r\n- <a href="http://www.yetanotherblog.de/">yetanotherblog.de</a> - Yet Another Blog<br />\r\n<br />\r\nMulti user blogs<br />\r\n- <a href="http://tipos.com.br/">tipos.com.br</a> - Blogging community<br />\r\n<br />\r\nHobby, Travel and News sites<br />\r\n- <a href="http://adrenalinsports.nl/">adrenalinsports.nl</a> - Extreme sports<br />\r\n- <a href="http://hsbluebird.com/">hsbluebird.com</a> - Hot Springs, Montana''s Online Resource <br />\r\n- <a href="http://groningen-info.de/">groningen-info.de</a> - Neues aus Groningen. Fr Leute aus Duitsland.<br />\r\n- <a href="http://www.americandaily.com/">americandaily.com</a> - American Daily - Home<br />\r\n<br />\r\n<b>Nucleus Developer Network - <a href="http://dev.nucleuscms.org/">dev.nucleuscms.org</a></b><br />\r\n<br />\r\nThe NUDN is a hub for developer sites and programming resources.<br />\r\n<br />\r\nNUDN satellite sites, handles, location and UTC offset:<br />\r\n- <a href="http://karma.nucleuscms.org/">karma</a> - Izegem +02<br />\r\n- <a href="http://hcgtv.net/">hcgtv</a> - Miami -05<br />\r\n- <a href="http://edmondhui.homeip.net/blog/nudn.php">admun</a> - Ottawa -04<br />\r\n- <a href="http://dev.budts.be/nucleus/">TeRanEX</a> - Ekeren +02<br />\r\n<br />\r\nSourceforge.net graciously hosts our <a href="http://sourceforge.net/projects/nucleuscms/">CVS repository</a>.<br />\r\n<br />\r\nWant to play around or test changes, visit our demo site at <a href="http://demo.nucleuscms.org/">demo.nucleuscms.org</a>.<br />\r\n<br />\r\nNot sure what plugins to use, visit the <a href="http://showcase.trentadams.com/">showcase site</a> where you can see plugins at play in their native habitat.<br />\r\n<br />\r\nThen visit the plugin repository at <a href="http://plugins.nucleuscms.org/">plugins.nucleuscms.org</a> for download and installation instructions.<br />\r\n<br />\r\n<b>寄付者一覧</b><br />\r\n<br />\r\n以下の<a href="http://nucleuscms.org/donators.php">素晴らしい人々</a>による<a href="http://nucleuscms.org/donate.php">援助</a>感謝を捧げます。<em>ありがとう!</em><br />\r\n<br />\r\n- <a href="http://reddustrec.net/">dkex</a><br />\r\n- <a href="http://www.uncoverthenet.com/">Uncover the Net</a><br />\r\n- <a href="http://www.webatlas.org/">Web Atlas</a><br />\r\n- <a href="http://www.ipnlighting.com/">IPN Lighting</a><br />\r\n- <a href="http://blog.datoka.jp/">Yu (blog.datoka.jp)</a><br />\r\n- <a href="http://www.thegadgetreview.com/">Sony Gadgets and Reviews</a><br />\r\n- <a href="http://sites.proliphus.com/blueZhift/blog/">Thomas McKibben</a><br />\r\n- <a href="http://cheapweb.us/">CheapWeb.us</a><br />\r\n- Robert Seyfriedsberger<br />\r\n- <a href="http://www.toxicologie.nl/">Toxicologie.nl</a><br />\r\n- Gordon Shum<br />\r\n- <a href="http://www.subsim.com/">Neal Stevens</a><br />\r\n- <a href="http://www.GamblingHelper.com/">GamblingHelper</a><br />\r\n- Oliver Kirstein<br />\r\n- <a href="http://www.dominiek.be/">Dominiek</a><br />\r\n- <a href="http://www.aardschok.net/">Aardschok</a><br />\r\n- <a href="http://www.nieuwevoordeur.be/">nieuwevoordeur.be</a><br />\r\n- <a href="http://www.scene24.net/">Scene24</a><br />\r\n- <a href="http://www.eug.be/">Eug''s Weblog</a><br />\r\n- <a href="http://www.bloggard.com/">The Adventures of Bloggard</a><br />\r\n- <a href="http://www.voltos.com/">Arthur Cronos from Voltos</a><br />\r\n- <a href="http://www.webmaster-toolkit.com/">Free Webmaster Tools and Resources</a><br />\r\n- <a href="http://www.domilog.be/">Domi''s Weblog</a><br />\r\n- Infodoma          <br />\r\n- <a href="http://carvingcode.com/">carvingCode.com</a><br />\r\n- <a href="http://www.traweb.com/">Traweb</a><br />\r\n- <a href="http://gene.mm2u.com/">Gene''s MoBlog</a><br />\r\n- <a href="http://interfacethis.com/">InterfaceThis</a><br />\r\n- <a href="http://www.thefinsters.com/flog/">The Finster Log</a><br />\r\n- <a href="http://www.mrhop.com/">Hop Nguyen</a><br />\r\n- <a href="http://www.zwavel.com/~zwavelaars" title="Zwavelaars">Zwavelaars</a><br />\r\n- <a href="http://beefcake.nl/">Joaquin Scholten</a>      <br />\r\n- <a href="http://www.roelgroeneveld.com/">Roel Groeneveld</a><br />\r\n- <a href="http://lvb.net/">LVBlog</a><br />\r\n- <a href="http://xandermol.com/">Xander Mol</a><br />\r\n- Danilo Massa<br />\r\n- <a href="http://01FTP.com/">01FTP.com</a><br />\r\n- <a href="http://www.adrenalinsports.nl/">Irmo Keizer</a><br />\r\n- <a href="http://www.jasonkrogh.com/">Jason Krogh</a><br />\r\n- <a href="http://www.higuchi.com/">Osamu Higuchi</a><br />\r\n- <a href="http://www.trentadams.com/">Trent Adams</a><br />\r\n- <a href="http://www.ppcw.net/">Arne Hess</a><br />\r\n- <a href="http://hsbluebird.com/">The Bluebird</a><br />\r\n- Rainer Bickel<br />\r\n- Fritz Elfers<br />\r\n- <a href="http://www.european-wall-tapestries.com/">European Wall Tapestries</a><br />\r\n- <a href="http://www.jamier.net/">Jamie R. Rytlewski</a><br />\r\n- Madolyn Piper<br />\r\n- <a href="http://www.batteryvalues.com/">Battery Values</a><br />\r\n- <a href="http://www.mixburnrip.de/">Janko Roettgers</a><br />\r\n- Lukas Loesche<br />\r\n- <a href="http://www.seobook.com/">SEO Book</a><br />\r\n- <a href="http://www.brandweerdematen.nl/">Brandweer de Maten</a><br />\r\n- Andy Fuchs<br />\r\n- <a href="http://www.sumoforce.com/">Sumoforce</a><br />\r\n- <a href="http://love.silverindigo.com/">Al''ky''mie</a><br />\r\n- <a href="http://www.pejo.us/">Peter Johnson</a><br />\r\n- <a href="http://www.triv.nl/">TriV Internet Solutions</a><br />\r\n- <a href="http://www.torontomusicians.org/nucleus/">Margaret Stowe</a><br />\r\n- <a href="http://www.zenkey.org/">zenkey dot org</a><br />\r\n- <a href="http://www.golb.org/">Blots of Info</a><br />\r\n- <a href="http://www.zonderpartij.be/">Rudi De Kerpel</a><br />\r\n- <a href="http://staylorx.com/">Steve Taylor</a><br />\r\n- <a href="http://lmhcave.com/">Malcolm Farnsworth</a><br />\r\n- Birgit Kellner<br />\r\n- <a href="http://www.tobiasly.com/">Toby Johnson</a><br />\r\n- <a href="http://www.kapingamarangi.be/">Kapingamarangi</a><br />\r\n- <a href="http://www.pallalink.net/">Pallalink</a><br />\r\n- <a href="http://publiustx.net/">PubliusTX Weblog</a><br />\r\n- <a href="http://www.reductioadabsurdum.net/">Reductio Ad Absurdum</a><br />\r\n- <a href="http://www.gagaweb.org/">GagaWeb</a><br />\r\n- <a href="http://www.videokid.be/">Videokid</a><br />\r\n- Jon Marr<br />\r\n- <a href="http://www.docblog.org/">Luigi Cristiano</a><br />\r\n- J Keith Lehman<br />\r\n- Bohemian Cachet<br />\r\n- Jesus Mourazos<br />\r\n- <a href="http://ltp-design.com/">Stephen Jones</a><br />\r\n- <a href="http://oha.nu/">One-Handed Apps</a><br />\r\n- Alwin Hawkins<br />\r\n- <a href="http://jstigall.bloomington.in.us">Justin Stigall</a><br />\r\n- <a href="http://www.itismylife.com/">It is my life</a><br />\r\n- Greg Morrill<br />\r\n- <a href="http://www.dutchsubmarines.com/">Dutch Submarines</a><br />\r\n- <a href="http://www.7thwatch.com/">Seventh Watch Design Studios</a>                <br />\r\n- <a href="http://www.macnet2.com/">MacNetv2</a>      <br />\r\n- Richard Noordhof<br />\r\n- <a href="http://www.jamier.net/">Jamie Rytlewski</a><br />\r\n<br />\r\nNucleusが気に入りましたか? <a href="http://www.hotscripts.com/Detailed/13368.html?RID=nucleus@demuynck.org">HotScripts</a>や<a href="http://www.opensourcecms.com/index.php?option=content&task=view&id=145">opensourceCMS<a>での投票をお願いします。<br />\r\n<br />\r\n<b>ライセンス</b><br />\r\n<br />\r\n私たちがフリー・ソフトウェアについて口にする場合は自由のことに言及しているのであって、価格のことではありません。私たちの<a href="http://www.gnu.org/licenses/gpl.html">一般公有使用許諾書</a>(<a href="http://www.gnu.org/licenses/gpl.ja.html">日本語訳</a>と<a href="http://www.atmarkit.co.jp/aig/03linux/gpl.html">概要</a>)は、フリー・ソフトウェアの複製物を自由に頒布できること(そして、望むならこのサービスに対して対価を請求できること)、ソース・コードを実際に受け取るか希望しさえすれば入手することが可能であること、入手したソフトウェアを変更したり新しいフリー・プログラムの一部として使用できること、以上の各内容を行なうことができるということをユーザ自身が知っていることを実現できるようにデザインされています。', 1, 1, '2005-02-16 22:57:54', 0, 0, 0, 1, 0);\r
 \r
 CREATE TABLE `nucleus_karma` (\r
   `itemid` int(11) NOT NULL default '0',\r
@@ -153,7 +153,7 @@ CREATE TABLE `nucleus_member` (
   UNIQUE KEY `mnumber` (`mnumber`)\r
 ) TYPE=MyISAM;\r
 \r
-INSERT INTO `nucleus_member` VALUES (1, 'God', 'God', '714d82a0a84f9c6e3495fe2aa5618627', 'example@example.org', 'http://localhost:8080/nucleus/', '', 1, 1, '2b0b7cec42e697b5aae52461b2398e44', '');\r
+INSERT INTO `nucleus_member` VALUES (1, 'example', 'example', '1a79a4d60de6718e8e5b326e338ae533', 'example@example.org', 'http://localhost:8080/nucleus/', '', 1, 1, 'd767aefc60415859570d64c649257f19', '');\r
 \r
 CREATE TABLE `nucleus_plugin` (\r
   `pid` int(11) NOT NULL auto_increment,\r
@@ -240,6 +240,12 @@ INSERT INTO `nucleus_template` VALUES (4, 'ITEM', '<%date(utc)%>');
 INSERT INTO `nucleus_template` VALUES (5, 'ITEM', '<entry>\r\n <title type="text/html" mode="escaped"><![CDATA[<%title%>]]></title>\r\n <link rel="alternate" type="text/html" href="<%blogurl%>index.php?itemid=<%itemid%>" />\r\n <author>\r\n  <name><%author%></name>\r\n </author>\r\n <modified><%date(utc)%></modified>\r\n <issued><%date(iso8601)%></issued>\r\n <content type="text/html" mode="escaped"><![CDATA[<%body%><%more%>]]></content>\r\n <id><%blogurl%>:<%blogid%>:<%itemid%></id>\r\n</entry>');\r
 INSERT INTO `nucleus_template` VALUES (3, 'FORMAT_DATE', '%Y-%m-%d');\r
 INSERT INTO `nucleus_template` VALUES (3, 'FORMAT_TIME', '%H:%M:%S');\r
+INSERT INTO `nucleus_template` VALUES (5, 'POPUP_CODE', '<%image%>');\r
+INSERT INTO `nucleus_template` VALUES (5, 'MEDIA_CODE', '<%media%>');\r
+INSERT INTO `nucleus_template` VALUES (5, 'IMAGE_CODE', '<%media%>');\r
+INSERT INTO `nucleus_template` VALUES (3, 'POPUP_CODE', '<%image%>');\r
+INSERT INTO `nucleus_template` VALUES (3, 'MEDIA_CODE', '<%media%>');\r
+INSERT INTO `nucleus_template` VALUES (3, 'IMAGE_CODE', '<%media%>');\r
 \r
 \r
 CREATE TABLE `nucleus_template_desc` (\r
index 0252bfe..804a6ef 100755 (executable)
@@ -1,5 +1,5 @@
 <?php\r
-/**\r
+/*\r
   * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/) \r
   * Copyright (C) 2002-2005 The Nucleus Group\r
   *\r
@@ -8,12 +8,15 @@
   * as published by the Free Software Foundation; either version 2\r
   * of the License, or (at your option) any later version.\r
   * (see nucleus/documentation/index.html#license for more info)\r
-  *\r
+ */\r
+/**\r
   * This script allows adding items to Nucleus through bookmarklets. The member must be logged in\r
   * in order to use this.\r
   *\r
-  * $Id: bookmarklet.php,v 1.5 2005-03-16 07:55:53 kimitake Exp $\r
-  * $NucleusJP: bookmarklet.php,v 1.4 2005/03/15 08:24:16 kimitake Exp $\r
+ * @license http://nucleuscms.org/license.txt GNU General Public License\r
+ * @copyright Copyright (C) 2002-2005 The Nucleus Group\r
+ * @version $Id: bookmarklet.php,v 1.5.2.1 2005-08-25 07:04:13 kimitake Exp $\r
+ * @version $NucleusJP: bookmarklet.php,v 1.5 2005/03/16 07:55:53 kimitake Exp $\r
   */\r
 \r
 // bookmarklet is part of admin area (might need XML-RPC)\r
@@ -90,7 +93,8 @@ function bm_doAddItem() {
                $extrahead = '';\r
        } elseif ((postVar('actiontype') == 'addnow') && $blog->pingUserland()) {\r
                $message = 'アイテムの追加に成功しました。現在weblogs.comにpingを送っています。しばらくの間お待ちください...';\r
-               $extrahead = '<meta http-equiv="refresh" content="1; url=index.php?action=sendping&amp;blogid=' . $blogid . '" />';\r
+               $pingUrl = $manager->addTicketToUrl($CONF['AdminURL'] . 'index.php?action=sendping&blogid=' . intval($blogid));\r
+               $extrahead = '<meta http-equiv="refresh" content="1; url=' . htmlspecialchars($pingUrl). '" />';\r
        } else {\r
                $message = _ITEM_ADDED;\r
                $extrahead = '';\r
index 5c671f3..6e3d29f 100755 (executable)
@@ -2,6 +2,7 @@
 \r
 <form method="post" action="<%formdata(adminurl)%>index.php">\r
  <div class="blogform">\r
+   <%ticket%>\r
    <input type="hidden" name="action" value="additem" />\r
    <input type="hidden" name="actiontype" value="addnow" />               \r
    <input type="hidden" name="closed" value="0" />                \r
@@ -26,4 +27,4 @@
    <span class="shortcuts">[ctrl+shift+A]&nbsp;=&nbsp;Link, [ctrl+shift+B]&nbsp;=&nbsp;Bold, [ctrl+shift+I]&nbsp;=&nbsp;Italic, [ctrl+shift+M]&nbsp;=&nbsp;Insert&nbsp;Media.</span>\r
    <%callback(FormExtra,additemform)%> \r
  </div>\r
-</form>
\ No newline at end of file
+</form>\r
index 698b081..9d8e1a0 100755 (executable)
@@ -1,3 +1,4 @@
+<a id="nucleus_lf"></a>\r
 <div class="loginform">\r
        <%text(_LOGINFORM_YOUARE)%> <%formdata(membername)%> ! (<a href="<%self%>?action=logout"><%text(_LOGOUT)%></a>)\r
 </div>\r
index 7ae420a..ba69f17 100755 (executable)
@@ -1,5 +1,9 @@
-<form method="post" action="<%self%>">\r
+<a id="nucleus_lf"></a>\r
+<form method="post" action="#nucleus_lf">\r
   <div class="loginform">\r
+  \r
+       <%errordiv%>\r
+  \r
        <input type="hidden" name="action" value="login" />\r
        <label for="nucleus_lf_name" accesskey="l"><%text(_LOGINFORM_NAME)%></label>: <input id="nucleus_lf_name" name="login" size="10" value="" class="formfield" />\r
        <br />\r
index 6907a55..e41946a 100755 (executable)
@@ -1,5 +1,5 @@
 <?php\r
-/**\r
+/*\r
   * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
   * Copyright (C) 2002-2005 The Nucleus Group\r
   *\r
@@ -8,9 +8,12 @@
   * 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
-  * $Id: index.php,v 1.5 2005-03-16 07:55:05 kimitake Exp $\r
-  * $NucleusJP$\r
+ */\r
+/**\r
+ * @license http://nucleuscms.org/license.txt GNU General Public License\r
+ * @copyright Copyright (C) 2002-2005 The Nucleus Group\r
+ * @version $Id: index.php,v 1.5.2.1 2005-08-25 07:04:13 kimitake Exp $\r
+ * @version $NucleusJP: index.php,v 1.5 2005/03/16 07:55:05 kimitake Exp $\r
   */\r
        // we are using admin stuff:\r
        $CONF = array();\r
index b63e560..7b415d9 100755 (executable)
@@ -1,6 +1,6 @@
 <?php\r
 \r
-/**\r
+/*\r
   * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/) \r
   * Copyright (C) 2002-2005 The Nucleus Group\r
   *\r
@@ -9,11 +9,14 @@
   * as published by the Free Software Foundation; either version 2\r
   * of the License, or (at your option) any later version.\r
   * (see nucleus/documentation/index.html#license for more info)\r
-  *\r
+ */\r
+/**\r
   * Actions that can be called via action.php\r
   *\r
-  * $Id: ACTION.php,v 1.2.2.1 2005-07-01 06:40:39 kimitake Exp $\r
-  * $NucleusJP: ACTION.php,v 1.2 2005/03/12 06:19:04 kimitake Exp $\r
+ * @license http://nucleuscms.org/license.txt GNU General Public License\r
+ * @copyright Copyright (C) 2002-2005 The Nucleus Group\r
+ * @version $Id: ACTION.php,v 1.2.2.2 2005-08-25 07:04:14 kimitake Exp $\r
+ * @version $NucleusJP: ACTION.php,v 1.2.2.1 2005/07/01 06:40:39 kimitake Exp $\r
   */\r
 class ACTION\r
 {\r
@@ -130,9 +133,13 @@ class ACTION
                } else {\r
                        $CONF['MemberURL'] = $CONF['IndexURL'];\r
                        if ($CONF['URLMode'] == 'pathinfo')\r
-                               $url = createMemberLink($tomem->getID());\r
+                       {\r
+                               $url = createLink('member', array('memberid' => $tomem->getID(), 'name' => $tomem->getDisplayName()));\r
+                       }\r
                        else\r
+                       {\r
                                $url = $CONF['IndexURL'] . createMemberLink($tomem->getID());\r
+                       }\r
                        redirect($url);\r
                }\r
                \r
index cbf6c9a..46b48f2 100755 (executable)
@@ -1,5 +1,5 @@
 <?php\r
-/**\r
+/*\r
   * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/) \r
   * Copyright (C) 2002-2005 The Nucleus Group\r
   *\r
@@ -8,11 +8,14 @@
   * as published by the Free Software Foundation; either version 2\r
   * of the License, or (at your option) any later version.\r
   * (see nucleus/documentation/index.html#license for more info)\r
-  *\r
+ */\r
+/**\r
   * Actionlog class for Nucleus\r
   *\r
-  * $Id: ACTIONLOG.php,v 1.3 2005-03-12 06:19:04 kimitake Exp $\r
-  * $NucleusJP$\r
+ * @license http://nucleuscms.org/license.txt GNU General Public License\r
+ * @copyright Copyright (C) 2002-2005 The Nucleus Group\r
+ * @version $Id: ACTIONLOG.php,v 1.3.2.1 2005-08-25 07:04:14 kimitake Exp $\r
+ * @version $NucleusJP: ACTIONLOG.php,v 1.3 2005/03/12 06:19:04 kimitake Exp $\r
   */\r
 define('ERROR',1);             // only errors\r
 define('WARNING',2);   // errors and warnings\r
index f07dc03..e3c96c8 100755 (executable)
@@ -1,5 +1,5 @@
 <?php\r
-/**\r
+/*\r
   * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
   * Copyright (C) 2002-2005 The Nucleus Group\r
   *\r
@@ -8,11 +8,14 @@
   * as published by the Free Software Foundation; either version 2\r
   * of the License, or (at your option) any later version.\r
   * (see nucleus/documentation/index.html#license for more info)\r
-  *\r
+ */\r
+/**\r
   * The code for the Nucleus admin area\r
   *\r
-  * $Id: ADMIN.php,v 1.4.2.2 2005-07-01 06:40:17 kimitake Exp $\r
-  * $NucleusJP: ADMIN.php,v 1.4 2005/03/12 06:19:04 kimitake Exp $\r
+ * @license http://nucleuscms.org/license.txt GNU General Public License\r
+ * @copyright Copyright (C) 2002-2005 The Nucleus Group\r
+ * @version $Id: ADMIN.php,v 1.4.2.3 2005-08-25 07:04:14 kimitake Exp $\r
+ * @version $NucleusJP: ADMIN.php,v 1.4.2.2 2005/07/01 06:40:17 kimitake Exp $\r
   */\r
 \r
 class ADMIN {\r
@@ -1836,23 +1839,26 @@ class ADMIN {
 \r
                $mem->write();\r
 \r
+               // store plugin options\r
+               $aOptions = requestArray('plugoption');\r
+               NucleusPlugin::_applyPluginOptions($aOptions);\r
+               $manager->notify('PostPluginOptionsUpdate',array('context' => 'member', 'memberid' => $memberid, 'member' => &$mem));\r
+\r
                // if email changed, generate new password\r
                if ($oldEmail != $mem->getEmail())\r
                {\r
                        $mem->sendActivationLink('addresschange', $oldEmail);\r
                        // logout member\r
                        $mem->newCookieKey();\r
-                       $member->logout();\r
+\r
+                       // only log out if the member being edited is the current member.\r
+                       if ($member->getID() == $memberid)\r
+                               $member->logout();\r
                        $this->action_login(_MSG_ACTIVATION_SENT, 0);\r
                        return;\r
                }\r
 \r
 \r
-               // store plugin options\r
-               $aOptions = requestArray('plugoption');\r
-               NucleusPlugin::_applyPluginOptions($aOptions);\r
-               $manager->notify('PostPluginOptionsUpdate',array('context' => 'member', 'memberid' => $memberid, 'member' => &$mem));\r
-\r
                if (  ( $mem->getID() == $member->getID() )\r
                   && ( $newpass || ( $mem->getDisplayName() != $member->getDisplayName() ) )\r
                   ) {\r
@@ -1865,7 +1871,7 @@ class ADMIN {
        }\r
 \r
        function action_memberadd() {\r
-               global $member;\r
+               global $member, $manager;\r
 \r
                // check if allowed\r
                $member->isAdmin() or $this->disallow();\r
@@ -1879,6 +1885,11 @@ class ADMIN {
                if ($res != 1)\r
                        $this->error($res);\r
 \r
+               // fire PostRegister event                      \r
+               $newmem = new MEMBER();\r
+               $newmem->readFromName(postVar('name'));\r
+               $manager->notify('PostRegister',array('member' => &$newmem));                   \r
+\r
                $this->action_usermanagement();\r
        }\r
 \r
@@ -3312,6 +3323,10 @@ selector();
                // read only metadata\r
                $error = $importer->readFile($skinFile, 1);\r
 \r
+               // clashes\r
+               $skinNameClashes = $importer->checkSkinNameClashes();\r
+               $templateNameClashes = $importer->checkTemplateNameClashes();\r
+               $hasNameClashes = (count($skinNameClashes) > 0) || (count($templateNameClashes) > 0);\r
 \r
                if ($error) $this->error($error);\r
 \r
@@ -3325,8 +3340,15 @@ selector();
                        <li><p><strong><?php echo _SKINIE_INFO_GENERAL?></strong> <?php echo htmlspecialchars($importer->getInfo())?></p></li>\r
                        <li><p><strong><?php echo _SKINIE_INFO_SKINS?></strong> <?php echo implode(' <em>'._AND.'</em> ',$importer->getSkinNames())?></p></li>\r
                        <li><p><strong><?php echo _SKINIE_INFO_TEMPLATES?></strong> <?php echo implode(' <em>'._AND.'</em> ',$importer->getTemplateNames())?></p></li>\r
-                       <li><p><strong style="color: red;"><?php echo _SKINIE_INFO_SKINCLASH?></strong> <?php echo implode(' <em>'._AND.'</em> ',$importer->checkSkinNameClashes())?></p></li>\r
-                       <li><p><strong style="color: red;"><?php echo _SKINIE_INFO_TEMPLCLASH?></strong> <?php echo implode(' <em>'._AND.'</em> ',$importer->checkTemplateNameClashes())?></p></li>\r
+                       <?php\r
+                               if ($hasNameClashes)\r
+                               {\r
+                       ?>\r
+                       <li><p><strong style="color: red;"><?php echo _SKINIE_INFO_SKINCLASH?></strong> <?php echo implode(' <em>'._AND.'</em> ',$skinNameClashes)?></p></li>\r
+                       <li><p><strong style="color: red;"><?php echo _SKINIE_INFO_TEMPLCLASH?></strong> <?php echo implode(' <em>'._AND.'</em> ',$templateNameClashes)?></p></li>\r
+                       <?php\r
+                               } // if (hasNameClashes)\r
+                       ?>\r
                </ul>\r
 \r
                <form method="post" action="index.php"><div>\r
@@ -3335,8 +3357,15 @@ selector();
                        <input type="hidden" name="skinfile" value="<?php echo htmlspecialchars(postVar('skinfile'))?>" />\r
                        <input type="hidden" name="mode" value="<?php echo htmlspecialchars($mode)?>" />\r
                        <input type="submit" value="<?php echo _SKINIE_CONFIRM_IMPORT?>" />\r
+                       <?php\r
+                               if ($hasNameClashes)\r
+                               {\r
+                       ?>\r
                        <br />\r
                        <input type="checkbox" name="overwrite" value="1" id="cb_overwrite" /><label for="cb_overwrite"><?php echo _SKINIE_CONFIRM_OVERWRITE?></label>\r
+                       <?php\r
+                               } // if (hasNameClashes)\r
+                       ?>\r
                </div></form>\r
 \r
 \r
@@ -5272,22 +5301,6 @@ selector();
                if (!checkPlugin($name))\r
                        $this->error(_ERROR_PLUGFILEERROR . ' (' . $name . ')');\r
 \r
-               // check if the plugin dependency is met\r
-               $plugin =& $manager->getPlugin($name);\r
-               $pluginList = $plugin->getPluginDep();\r
-               foreach ($pluginList as $pluginName)\r
-               {\r
-\r
-                       $res = sql_query('SELECT * FROM '.sql_table('plugin') . ' WHERE pfile="' . $pluginName . '"');\r
-                       if (mysql_num_rows($res) == 0)\r
-                       {\r
-                               // uninstall plugin again...\r
-                               $this->deleteOnePlugin($plugin->getID());\r
-\r
-                               $this->error(_ERROR_INSREQPLUGIN . $pluginName);\r
-                       }\r
-               }\r
-\r
                // get number of currently installed plugins\r
                $numCurrent = mysql_num_rows(sql_query('SELECT * FROM '.sql_table('plugin')));\r
 \r
@@ -5306,12 +5319,12 @@ selector();
                sql_query($query);\r
                $iPid = mysql_insert_id();\r
 \r
-               // need to update the plugin object's pid since we didn't have it above when it's first create....\r
-               $plugin->plugid = $iPid;\r
-\r
                $manager->clearCachedInfo('installedPlugins');\r
 \r
-               // call the install method of the plugin\r
+               // Load the plugin for condition checking and instalation\r
+               $plugin =& $manager->getPlugin($name);\r
+\r
+               // check if it got loaded (could have failed)\r
                if (!$plugin)\r
                {\r
                        sql_query('DELETE FROM ' . sql_table('plugin') . ' WHERE pid='. intval($iPid));\r
@@ -5320,25 +5333,30 @@ selector();
                }\r
 \r
                // check if plugin needs a newer Nucleus version\r
-               if (getNucleusVersion() < $plugin->getMinNucleusVersion())\r
+               if ((getNucleusVersion() == $plugin->getMinNucleusVersion()) && (getNucleusPatchLevel() < $plugin->getMinNucleusPatchLevel()))\r
                {\r
                        // uninstall plugin again...\r
                        $this->deleteOnePlugin($plugin->getID());\r
 \r
                        // ...and show error\r
-                       $this->error(_ERROR_NUCLEUSVERSIONREQ . $plugin->getMinNucleusVersion());\r
+                       $this->error(_ERROR_NUCLEUSVERSIONREQ . $plugin->getMinNucleusVersion() . ' patch ' . $plugin->getMinNucleusPatchLevel());\r
                }\r
 \r
-               // check if plugin needs a newer Nucleus version\r
-               if ((getNucleusVersion() == $plugin->getMinNucleusVersion()) && (getNucleusPatchLevel() < $plugin->getMinNucleusPatchLevel()))\r
+               $pluginList = $plugin->getPluginDep();\r
+               foreach ($pluginList as $pluginName)\r
                {\r
-                       // uninstall plugin again...\r
-                       $this->deleteOnePlugin($plugin->getID());\r
 \r
-                       // ...and show error\r
-                       $this->error(_ERROR_NUCLEUSVERSIONREQ . $plugin->getMinNucleusVersion() . ' patch ' . $plugin->getMinNucleusPatchLevel());\r
+                       $res = sql_query('SELECT * FROM '.sql_table('plugin') . ' WHERE pfile="' . $pluginName . '"');\r
+                       if (mysql_num_rows($res) == 0)\r
+                       {\r
+                               // uninstall plugin again...\r
+                               $this->deleteOnePlugin($plugin->getID());\r
+\r
+                               $this->error(_ERROR_INSREQPLUGIN . $pluginName);\r
+                       }\r
                }\r
 \r
+               // call the install method of the plugin\r
                $plugin->install();\r
 \r
                $manager->notify(\r
index 61db1f8..721c775 100755 (executable)
@@ -1,5 +1,5 @@
 <?php\r
-/**\r
+/*\r
   * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/) \r
   * Copyright (C) 2002-2005 The Nucleus Group\r
   *\r
@@ -8,11 +8,14 @@
   * as published by the Free Software Foundation; either version 2\r
   * of the License, or (at your option) any later version.\r
   * (see nucleus/documentation/index.html#license for more info)\r
-  *\r
+ */\r
+/**\r
   * PHP class responsible for ban-management. \r
   *\r
-  * $Id: BAN.php,v 1.3 2005-03-12 06:19:05 kimitake Exp $\r
-  * $NucleusJP$\r
+ * @license http://nucleuscms.org/license.txt GNU General Public License\r
+ * @copyright Copyright (C) 2002-2005 The Nucleus Group\r
+ * @version $Id: BAN.php,v 1.3.2.1 2005-08-25 07:04:14 kimitake Exp $\r
+ * @version $NucleusJP: BAN.php,v 1.3 2005/03/12 06:19:05 kimitake Exp $\r
   */\r
   \r
 class BAN {\r
index a5797a0..f7cd285 100755 (executable)
@@ -1,6 +1,6 @@
 <?php\r
 \r
-/**\r
+/*\r
   * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/) \r
   * Copyright (C) 2002-2005 The Nucleus Group\r
   *\r
@@ -9,12 +9,15 @@
   * as published by the Free Software Foundation; either version 2\r
   * of the License, or (at your option) any later version.\r
   * (see nucleus/documentation/index.html#license for more info)\r
-  *\r
+ */\r
+/**\r
   * 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-12 06:19:05 kimitake Exp $\r
-  * $NucleusJP$\r
+ * @license http://nucleuscms.org/license.txt GNU General Public License\r
+ * @copyright Copyright (C) 2002-2005 The Nucleus Group\r
+ * @version $Id: BLOG.php,v 1.3.2.1 2005-08-25 07:04:14 kimitake Exp $\r
+ * @version $NucleusJP: BLOG.php,v 1.3 2005/03/12 06:19:05 kimitake Exp $\r
   */\r
 class BLOG {\r
        \r
@@ -179,13 +182,15 @@ class BLOG {
                                        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
+                                               $tmp_footer = strftime($template['DATE_FOOTER'], $oldTS);\r
+                                               $parser->parse($tmp_footer);\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
+                                       $tmp_header = strftime($template['DATE_HEADER'],$timestamp);\r
+                                       $parser->parse($tmp_header);\r
                                        $manager->notify('PostDateHead',array('blog' => &$this, 'timestamp' => $timestamp));                                    \r
                                }\r
                                $old_date = $new_date;\r
@@ -620,7 +625,14 @@ class BLOG {
                while ($data = mysql_fetch_assoc($res)) {\r
                        $data['blogid'] = $this->getID();       \r
                        $data['blogurl'] = $blogurl;\r
-                       $data['catlink'] = createCategoryLink($data['catid'], $linkparams);\r
+                       $data['catlink'] = createLink(\r
+                                                               'category',\r
+                                                               array(\r
+                                                                       'catid' => $data['catid'],\r
+                                                                       'name' => $data['catname'],\r
+                                                                       'extra' => $linkparams\r
+                                                               )\r
+                                                          );\r
                        $data['self'] = $CONF['Self'];\r
 \r
                        $temp = TEMPLATE::fill($template['CATLIST_LISTITEM'],$data);\r
@@ -1121,19 +1133,54 @@ class ITEMACTIONS extends BaseActions {
        \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_categorylink() { echo createLink('category', array('catid' => $this->currentItem->catid, 'name' => $this->currentItem->category)); }\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_authorlink() {\r
+               echo createLink(\r
+                       'member',\r
+                       array(\r
+                               'memberid' => $this->currentItem->authorid,\r
+                               'name' => $this->currentItem->author,\r
+                               'extra' => $this->linkparams\r
+                       )\r
+               );\r
+       }\r
        function parse_query() {                echo $this->strHighlight; }\r
-       function parse_itemlink() {             echo createItemLink($this->currentItem->itemid, $this->linkparams); }\r
+       function parse_itemlink() {             \r
+               echo createLink(\r
+                       'item', \r
+                       array(\r
+                               'itemid' => $this->currentItem->itemid,\r
+                               'title' => $this->currentItem->title,\r
+                               'timestamp' => $this->currentItem->timestamp,\r
+                               'extra' => $this->linkparams\r
+                       )\r
+               );\r
+       }\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_title($format = '') {\r
+               switch ($format) {\r
+                       case 'xml':\r
+                               echo stringToXML ($this->currentItem->title);\r
+                               break;\r
+                       case 'attribute':\r
+                               echo stringToAttribute ($this->currentItem->title);\r
+                               break;\r
+                       case 'raw':\r
+                               echo $this->currentItem->title;\r
+                               break;\r
+                       default:\r
+                               $this->highlightAndParse($this->currentItem->title); \r
+                               break;\r
+               }\r
+       }\r
        \r
        function parse_karma($type = 'totalscore') {\r
                global $manager;\r
@@ -1202,7 +1249,7 @@ class ITEMACTIONS extends BaseActions {
        }                       \r
        \r
        function parse_date($format = '') {\r
-               echo formatDate($format, $this->currentItem->timestamp, $this->template['FORMAT_DATE']);\r
+               echo formatDate($format, $this->currentItem->timestamp, $this->template['FORMAT_DATE'], $this->blog);\r
        }\r
        \r
        /**\r
@@ -1226,7 +1273,8 @@ class ITEMACTIONS extends BaseActions {
        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
+                       $tmp_highlight = htmlspecialchars(shorten($syndicated,$maxLength,'...'));\r
+                       echo $this->highlightAndParse($tmp_highlight);\r
                } else {\r
                echo htmlspecialchars(shorten($syndicated,$maxLength,'...'));\r
                }\r
@@ -1338,7 +1386,8 @@ class ITEMACTIONS extends BaseActions {
        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
+               $tmp_highlight = $this->highlight($data);\r
+               $this->parser->parse($tmp_highlight);\r
                $this->parser->actions = $this->getDefinedActions();\r
        }\r
        \r
@@ -1360,7 +1409,9 @@ class ITEMACTIONS extends BaseActions {
                $vars['width']                  = $width;\r
                $vars['height']                 = $height;\r
                $vars['text']                   = $text;\r
-               \r
+               $vars['link']                   = htmlspecialchars($CONF['MediaURL'] . $filename);\r
+               $vars['media']                  = '<a href="' . $vars['link'] . '">' . $vars['popuptext'] . '</a>';             \r
+\r
                echo TEMPLATE::fill($this->template['POPUP_CODE'],$vars);\r
        }\r
        \r
@@ -1380,7 +1431,7 @@ class ITEMACTIONS extends BaseActions {
                $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
+               $vars['media']                  = '<a href="' . $vars['link'] . '">' . $vars['text'] . '</a>';\r
                \r
                \r
                echo TEMPLATE::fill($this->template['IMAGE_CODE'],$vars);;\r
index 9d33b80..fd456d8 100755 (executable)
@@ -1,6 +1,6 @@
 <?php\r
 \r
-/**\r
+/*\r
   * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
   * Copyright (C) 2002-2005 The Nucleus Group\r
   *\r
@@ -9,11 +9,14 @@
   * as published by the Free Software Foundation; either version 2\r
   * of the License, or (at your option) any later version.\r
   * (see nucleus/documentation/index.html#license for more info)\r
-  *\r
+ */\r
+/**\r
   * A class representing a single comment\r
   *\r
-  * $Id: COMMENT.php,v 1.3 2005-03-12 06:19:05 kimitake Exp $\r
-  * $NucleusJP$\r
+ * @license http://nucleuscms.org/license.txt GNU General Public License\r
+ * @copyright Copyright (C) 2002-2005 The Nucleus Group\r
+ * @version $Id: COMMENT.php,v 1.3.2.1 2005-08-25 07:04:14 kimitake Exp $\r
+ * @version $NucleusJP: COMMENT.php,v 1.3 2005/03/12 06:19:05 kimitake Exp $\r
   */\r
 class COMMENT {\r
 \r
index 200c435..79e04a5 100755 (executable)
@@ -1,6 +1,6 @@
 <?php\r
 \r
-/**\r
+/*\r
   * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
   * Copyright (C) 2002-2005 The Nucleus Group\r
   *\r
@@ -9,11 +9,14 @@
   * as published by the Free Software Foundation; either version 2\r
   * of the License, or (at your option) any later version.\r
   * (see nucleus/documentation/index.html#license for more info)\r
-  *\r
+ */\r
+/**\r
   * A class representing the comments (all of them) for a certain post on a ceratin blog\r
   *\r
-  * $Id: COMMENTS.php,v 1.5 2005-03-12 06:19:05 kimitake Exp $\r
-  * $NucleusJP$\r
+ * @license http://nucleuscms.org/license.txt GNU General Public License\r
+ * @copyright Copyright (C) 2002-2005 The Nucleus Group\r
+ * @version $Id: COMMENTS.php,v 1.5.2.1 2005-08-25 07:04:14 kimitake Exp $\r
+ * @version $NucleusJP: COMMENTS.php,v 1.5 2005/03/12 06:19:05 kimitake Exp $\r
   */\r
 class COMMENTS {\r
 \r
@@ -71,7 +74,7 @@ class COMMENTS {
                if ($maxToShow == 0) {\r
                        $this->commentcount = $this->amountComments();\r
                } else {\r
-                       $query =  'SELECT c.cnumber as commentid, c.cbody as body, c.cuser as user, c.cmail as userid, c.cmember as memberid, c.ctime, c.chost as host, c.cip as ip, c.cblog as blogid'\r
+                       $query =  'SELECT c.citem as itemid, c.cnumber as commentid, c.cbody as body, c.cuser as user, c.cmail as userid, c.cmember as memberid, c.ctime, c.chost as host, c.cip as ip, c.cblog as blogid'\r
                                   . ' FROM '.sql_table('comment').' as c'\r
                                   . ' WHERE c.citem=' . $this->itemid\r
                                   . ' ORDER BY c.ctime';\r
@@ -277,6 +280,7 @@ class COMMENTACTIONS extends BaseActions {
 \r
        function getDefinedActions() {\r
                return array(\r
+                   'blogurl',\r
                        'commentcount',\r
                        'commentword',\r
                        'itemlink',\r
@@ -296,6 +300,9 @@ class COMMENTACTIONS extends BaseActions {
                        'userid',\r
                        'userlinkraw',\r
                        'userlink',\r
+                       'useremail',\r
+                       'userwebsite',\r
+                       'excerpt',\r
                        'short',\r
                        'skinfile',\r
                        'set',\r
@@ -320,9 +327,13 @@ class COMMENTACTIONS extends BaseActions {
                        else\r
                                $comment['userid'] = $mem->getEmail();\r
 \r
-                       $comment['userlinkraw'] = createMemberLink(\r
-                                                                               $comment['memberid'],\r
-                                                                               $this->commentsObj->itemActions->linkparams\r
+                       $comment['userlinkraw'] = createLink(\r
+                                                                               'member',\r
+                                                                               array(\r
+                                                                                       'memberid' => $comment['memberid'],\r
+                                                                                       'name' => $mem->getDisplayName(),\r
+                                                                                       'extra' => $this->commentsObj->itemActions->linkparams\r
+                                                                               )\r
                                                                          );\r
 \r
                } else {\r
@@ -339,6 +350,13 @@ class COMMENTACTIONS extends BaseActions {
                $this->currentComment =& $comment;\r
        }\r
 \r
+       function parse_blogurl() {              \r
+               global $manager;\r
+               $blogid = getBlogIDFromItemID($this->commentsObj->itemid);\r
+               $blog =& $manager->getBlog($blogid);\r
+               echo $blog->getURL(); \r
+       }\r
+\r
        function parse_commentcount() {                 echo $this->commentsObj->commentcount; }\r
        function parse_commentword() {\r
                if ($this->commentsObj->commentcount == 1)\r
@@ -347,7 +365,15 @@ class COMMENTACTIONS extends BaseActions {
                        echo $this->template['COMMENTS_MANY'];\r
        }\r
 \r
-       function parse_itemlink() {                             echo createItemLink($this->commentsObj->itemid, $this->commentsObj->itemActions->linkparams); }\r
+       function parse_itemlink() {\r
+               echo createLink(\r
+                       'item',\r
+                       array(\r
+                               'itemid' => $this->commentsObj->itemid,\r
+                               'extra' => $this->commentsObj->itemActions->linkparams\r
+                       )\r
+               );\r
+       }\r
        function parse_itemid() {                               echo $this->commentsObj->itemid; }\r
        function parse_itemtitle($maxLength = 0) {\r
                if ($maxLength == 0)\r
@@ -357,7 +383,7 @@ class COMMENTACTIONS extends BaseActions {
        }\r
 \r
        function parse_date($format = '') {\r
-               echo formatDate($format, $this->currentComment['timestamp'], $this->template['FORMAT_DATE']);\r
+               echo formatDate($format, $this->currentComment['timestamp'], $this->template['FORMAT_DATE'], $this->commentsObj->itemActions->blog);\r
        }\r
        function parse_time($format = '') {\r
                echo strftime(\r
@@ -384,6 +410,31 @@ class COMMENTACTIONS extends BaseActions {
                        echo $this->currentComment['user'];\r
                }\r
        }\r
+\r
+       function parse_useremail() {\r
+               if ($this->currentComment['memberid'] > 0)\r
+               {\r
+                       $member = new MEMBER();\r
+                       $member->readFromID($this->currentComment['memberid']);\r
+                       \r
+                       if ($member->email != '')\r
+                               echo $member->email;            \r
+               }\r
+               else\r
+               {\r
+                       if (!(strpos($this->currentComment['userlinkraw'], 'mailto:') === false))\r
+                               echo str_replace('mailto:', '', $this->currentComment['userlinkraw']);\r
+               }\r
+       }\r
+\r
+       function parse_userwebsite() {\r
+               if (!(strpos($this->currentComment['userlinkraw'], 'http://') === false))\r
+                       echo $this->currentComment['userlinkraw'];\r
+       }\r
+       \r
+       function parse_excerpt() {\r
+               echo stringToXML(shorten($this->currentComment['body'], 60, '...'));\r
+       }\r
        function parse_short() {\r
                $tmp = strtok($this->currentComment['body'],"\n");\r
                $tmp = str_replace('<br />','',$tmp);\r
index 01665b4..9c073d1 100755 (executable)
@@ -1,6 +1,6 @@
 <?php\r
 \r
-/**\r
+/*\r
   * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/) \r
   * Copyright (C) 2002-2005 The Nucleus Group\r
   *\r
@@ -9,11 +9,14 @@
   * as published by the Free Software Foundation; either version 2\r
   * of the License, or (at your option) any later version.\r
   * (see nucleus/documentation/index.html#license for more info)\r
-  *\r
+ */\r
+/**\r
   * A class representing an item\r
   *\r
-  * $Id: ITEM.php,v 1.3 2005-03-12 06:19:05 kimitake Exp $\r
-  * $NucleusJP$\r
+ * @license http://nucleuscms.org/license.txt GNU General Public License\r
+ * @copyright Copyright (C) 2002-2005 The Nucleus Group\r
+ * @version $Id: ITEM.php,v 1.3.2.1 2005-08-25 07:04:14 kimitake Exp $\r
+ * @version $NucleusJP$\r
   */\r
 class ITEM {\r
        \r
@@ -221,6 +224,8 @@ class ITEM {
                // off we go!\r
                sql_query($query);      \r
                \r
+               $manager->notify('PostUpdateItem',array('itemid' => $itemid));\r
+\r
                // when needed, move item and comments to new blog\r
                if ($moveNeeded) \r
                        ITEM::move($itemid, $catid);\r
index 26ca7c3..32c4e94 100755 (executable)
@@ -1,5 +1,5 @@
 <?php\r
-/**\r
+/*\r
   * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/) \r
   * Copyright (C) 2002-2005 The Nucleus Group\r
   *\r
@@ -8,11 +8,14 @@
   * as published by the Free Software Foundation; either version 2\r
   * of the License, or (at your option) any later version.\r
   * (see nucleus/documentation/index.html#license for more info)\r
-  *\r
+ */\r
+/**\r
   * Class representing the karma votes for a certain item\r
   *\r
-  * $Id: KARMA.php,v 1.3 2005-03-15 07:57:29 kimitake Exp $\r
-  * $NucleusJP$\r
+ * @license http://nucleuscms.org/license.txt GNU General Public License\r
+ * @copyright Copyright (C) 2002-2005 The Nucleus Group\r
+ * @version $Id: KARMA.php,v 1.3.2.1 2005-08-25 07:04:14 kimitake Exp $\r
+ * @version $NucleusJP$\r
   */\r
 class KARMA {\r
        \r
index b7dd4e0..e6f9a37 100755 (executable)
@@ -1,5 +1,5 @@
 <?php\r
-/**\r
+/*\r
   * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/) \r
   * Copyright (C) 2002-2005 The Nucleus Group\r
   *\r
@@ -8,7 +8,8 @@
   * as published by the Free Software Foundation; either version 2\r
   * of the License, or (at your option) any later version.\r
   * (see nucleus/documentation/index.html#license for more info)\r
-  *\r
+ */\r
+/**\r
   *    This class makes sure each item/weblog/comment object gets requested from\r
   * the database only once, by keeping them in a cache. The class also acts as \r
   * a dynamic classloader, loading classes _only_ when they are first needed,\r
   * The class is a singleton, meaning that there will be only one object of it\r
   * active at all times. The object can be requested using MANAGER::instance()\r
   *\r
-  * $Id: MANAGER.php,v 1.3 2005-03-12 06:19:05 kimitake Exp $\r
-  * $NucleusJP$\r
+ * @license http://nucleuscms.org/license.txt GNU General Public License\r
+ * @copyright Copyright (C) 2002-2005 The Nucleus Group\r
+ * @version $Id: MANAGER.php,v 1.3.2.1 2005-08-25 07:04:14 kimitake Exp $\r
+ * @version $NucleusJP$\r
   */\r
 class MANAGER {\r
 \r
index 9dc7793..0af805b 100755 (executable)
@@ -1,5 +1,5 @@
 <?php\r
-/**\r
+/*\r
   * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/) \r
   * Copyright (C) 2002-2005 The Nucleus Group\r
   *\r
@@ -8,11 +8,14 @@
   * as published by the Free Software Foundation; either version 2\r
   * of the License, or (at your option) any later version.\r
   * (see nucleus/documentation/index.html#license for more info)\r
-  *\r
+ */\r
+/**\r
   * Media classes for nucleus\r
   *\r
-  * $Id: MEDIA.php,v 1.3 2005-03-12 06:19:05 kimitake Exp $\r
-  * $NucleusJP$\r
+ * @license http://nucleuscms.org/license.txt GNU General Public License\r
+ * @copyright Copyright (C) 2002-2005 The Nucleus Group\r
+ * @version $Id: MEDIA.php,v 1.3.2.1 2005-08-25 07:04:14 kimitake Exp $\r
+ * @version $NucleusJP$\r
   */\r
 \r
 \r
index b301a65..ddd051f 100755 (executable)
@@ -1,6 +1,6 @@
 <?php\r
 \r
-/**\r
+/*\r
   * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/) \r
   * Copyright (C) 2002-2005 The Nucleus Group\r
   *\r
@@ -9,29 +9,32 @@
   * as published by the Free Software Foundation; either version 2\r
   * of the License, or (at your option) any later version.\r
   * (see nucleus/documentation/index.html#license for more info)\r
-  *\r
+ */\r
+/**\r
   * A class representing site members\r
   *\r
-  * $Id: MEMBER.php,v 1.4 2005-03-12 06:19:05 kimitake Exp $\r
-  * $NucleusJP$\r
+ * @license http://nucleuscms.org/license.txt GNU General Public License\r
+ * @copyright Copyright (C) 2002-2005 The Nucleus Group\r
+ * @version $Id: MEMBER.php,v 1.4.2.1 2005-08-25 07:04:14 kimitake Exp $\r
+ * @version $NucleusJP$\r
   */\r
 class MEMBER {\r
 \r
        // 1 when authenticated, 0 when not\r
-       var $loggedin;\r
+       var $loggedin = 0;\r
        var $password;          // not the actual password, but rather a MD5 hash       \r
 \r
        var $cookiekey;         // value that should also be in the client cookie to allow authentication\r
        \r
        // member info\r
-       var $id;\r
+       var $id = -1;\r
        var $realname;\r
        var $displayname;\r
        var $email;\r
        var $url;\r
-       var $language;          // name of the language file to use (e.g. 'english' -> english.php)\r
-       var $admin;                     // (either 0 or 1)\r
-       var $canlogin;          // (either 0 or 1)\r
+       var $language = '';             // name of the language file to use (e.g. 'english' -> english.php)\r
+       var $admin = 0;                 // (either 0 or 1)\r
+       var $canlogin = 0;              // (either 0 or 1)\r
        var $notes;\r
 \r
        // (private)\r
index 60465e5..5dc71fb 100755 (executable)
@@ -1,5 +1,5 @@
 <?php\r
-/**\r
+/*\r
   * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/) \r
   * Copyright (C) 2002-2005 The Nucleus Group\r
   *\r
@@ -8,12 +8,15 @@
   * as published by the Free Software Foundation; either version 2\r
   * of the License, or (at your option) any later version.\r
   * (see nucleus/documentation/index.html#license for more info)\r
-  *\r
+ */\r
+/**\r
   * Class used to represent a collection of e-mail addresses, to which a\r
   * message can be sent (e.g. comment or karma vote notification).\r
   *\r
-  * $Id: NOTIFICATION.php,v 1.3 2005-03-12 06:19:05 kimitake Exp $\r
-  * $NucleusJP$\r
+ * @license http://nucleuscms.org/license.txt GNU General Public License\r
+ * @copyright Copyright (C) 2002-2005 The Nucleus Group\r
+ * @version $Id: NOTIFICATION.php,v 1.3.2.1 2005-08-25 07:04:14 kimitake Exp $\r
+ * @version $NucleusJP: NOTIFICATION.php,v 1.3 2005/03/12 06:19:05 kimitake Exp $\r
   */\r
 class NOTIFICATION {\r
 \r
index 88a9fa4..cd64a2c 100755 (executable)
@@ -1,5 +1,5 @@
 <?php\r
-/**\r
+/*\r
   * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/) \r
   * Copyright (C) 2002-2005 The Nucleus Group\r
   *\r
@@ -8,9 +8,12 @@
   * 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
-  * $Id: PAGEFACTORY.php,v 1.4 2005-03-16 07:53:18 kimitake Exp $\r
-  * $NucleusJP$\r
+ */\r
+/**\r
+ * @license http://nucleuscms.org/license.txt GNU General Public License\r
+ * @copyright Copyright (C) 2002-2005 The Nucleus Group\r
+ * @version $Id: PAGEFACTORY.php,v 1.4.2.1 2005-08-25 07:04:14 kimitake Exp $\r
+ * @version $NucleusJP$\r
   */\r
 \r
 /**\r
index 277e52d..eb99760 100755 (executable)
@@ -1,5 +1,5 @@
 <?php\r
-/**\r
+/*\r
   * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/) \r
   * Copyright (C) 2002-2005 The Nucleus Group\r
   *\r
@@ -8,9 +8,12 @@
   * 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
-  * $Id: PARSER.php,v 1.3 2005-03-12 06:19:05 kimitake Exp $\r
-  * $NucleusJP$\r
+ */\r
+/**\r
+ * @license http://nucleuscms.org/license.txt GNU General Public License\r
+ * @copyright Copyright (C) 2002-2005 The Nucleus Group\r
+ * @version $Id: PARSER.php,v 1.3.2.1 2005-08-25 07:04:14 kimitake Exp $\r
+ * @version $NucleusJP$\r
   */\r
  \r
 /**\r
index 59c8e3a..182b451 100755 (executable)
@@ -1,4 +1,5 @@
-<?php  /**\r
+<?php\r
+       /*\r
          * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
          * Copyright (C) 2002-2005 The Nucleus Group\r
          *\r
@@ -7,14 +8,17 @@
          * as published by the Free Software Foundation; either version 2\r
          * of the License, or (at your option) any later version.\r
          * (see nucleus/documentation/index.html#license for more info)\r
-         *\r
+        */\r
+       /**\r
          * This is an (abstract) class of which all Nucleus Plugins must inherit\r
          *\r
          * for more information on plugins and how to write your own, see the\r
          * plugins.html file that is included with the Nucleus documenation\r
          *\r
-         * $Id: PLUGIN.php,v 1.3 2005-03-12 06:19:05 kimitake Exp $\r
-         * $NucleusJP$\r
+        * @license http://nucleuscms.org/license.txt GNU General Public License\r
+        * @copyright Copyright (C) 2002-2005 The Nucleus Group\r
+        * @version $Id: PLUGIN.php,v 1.3.2.1 2005-08-25 07:04:14 kimitake Exp $\r
+        * @version $NucleusJP$\r
          */\r
        class NucleusPlugin {\r
 \r
index cb6c003..a7ae332 100755 (executable)
@@ -1,6 +1,6 @@
 <?php\r
 \r
-/**\r
+/*\r
   * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/) \r
   * Copyright (C) 2002-2005 The Nucleus Group\r
   *\r
@@ -9,11 +9,14 @@
   * as published by the Free Software Foundation; either version 2\r
   * of the License, or (at your option) any later version.\r
   * (see nucleus/documentation/index.html#license for more info)\r
-  *\r
+ */\r
+/**\r
   * code to make it easier to create plugin admin areas\r
   *\r
-  * $Id: PLUGINADMIN.php,v 1.3 2005-03-12 06:19:05 kimitake Exp $\r
-  * $NucleusJP$\r
+ * @license http://nucleuscms.org/license.txt GNU General Public License\r
+ * @copyright Copyright (C) 2002-2005 The Nucleus Group\r
+ * @version $Id: PLUGINADMIN.php,v 1.3.2.1 2005-08-25 07:04:14 kimitake Exp $\r
+ * @version $NucleusJP$\r
   */\r
 \r
 global $HTTP_GET_VARS, $HTTP_POST_VARS, $HTTP_COOKIE_VARS, $HTTP_ENV_VARS, $HTTP_POST_FILES, $HTTP_SESSION_VARS;\r
index 56bd67e..56915c2 100755 (executable)
@@ -1,6 +1,6 @@
 <?php\r
 \r
-/**\r
+/*\r
   * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/) \r
   * Copyright (C) 2003-2005 The Nucleus Group\r
   *\r
@@ -9,7 +9,8 @@
   * as published by the Free Software Foundation; either version 2\r
   * of the License, or (at your option) any later version.\r
   * (see nucleus/documentation/index.html#license for more info)\r
-  *\r
+ */\r
+/**\r
   * SEARCH(querystring) offers different functionality to create an\r
   * SQL query to find certain items. (and comments)\r
   *\r
   * http://www.evolt.org/article/Boolean_Fulltext_Searching_with_PHP_and_MySQL/18/15665/\r
   * http://davidaltherr.net/web/php_functions/boolean/funcs.mysql.boolean.txt\r
   * \r
-  *\r
-  * $Id: SEARCH.php,v 1.4 2005-03-12 06:19:05 kimitake Exp $\r
-  $ $NucleusJP$\r
+ * @license http://nucleuscms.org/license.txt GNU General Public License\r
+ * @copyright Copyright (C) 2002-2005 The Nucleus Group\r
+ * @version $Id: SEARCH.php,v 1.4.2.1 2005-08-25 07:04:14 kimitake Exp $\r
+ $ @version $NucleusJP: SEARCH.php,v 1.4 2005/03/12 06:19:05 kimitake Exp $\r
   */\r
 \r
 \r
index c31a9f3..b704c50 100755 (executable)
@@ -1,7 +1,7 @@
 <?php\r
 \r
 \r
-/**\r
+/*\r
   * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
   * Copyright (C) 2002-2005 The Nucleus Group\r
   *\r
   * as published by the Free Software Foundation; either version 2\r
   * of the License, or (at your option) any later version.\r
   * (see nucleus/documentation/index.html#license for more info)\r
-  *\r
+ */\r
+/**\r
   * Class representing a skin\r
   *\r
-  * $Id: SKIN.php,v 1.4 2005-03-12 06:19:05 kimitake Exp $\r
-  * $NucleusJP$\r
+ * @license http://nucleuscms.org/license.txt GNU General Public License\r
+ * @copyright Copyright (C) 2002-2005 The Nucleus Group\r
+ * @version $Id: SKIN.php,v 1.4.2.1 2005-08-25 07:04:14 kimitake Exp $\r
+ * @version $NucleusJP: SKIN.php,v 1.5.2.1 2005/08/23 08:08:38 kimitake Exp $\r
   */\r
 class SKIN {\r
 \r
@@ -124,6 +127,8 @@ class SKIN {
        function parse($type) {\r
                global $manager, $CONF;\r
 \r
+               $manager->notify('InitSkinParse',array('skin' => &$this, 'type' => $type));\r
+\r
                // set output type\r
                sendContentType($this->getContentType(), 'skin', _CHARSET);\r
 \r
@@ -145,7 +150,7 @@ class SKIN {
 \r
                $actions = $this->getAllowedActionsForType($type);\r
 \r
-               $manager->notify('PreSkinParse',array('skin' => &$this, 'type' => $type));\r
+               $manager->notify('PreSkinParse',array('skin' => &$this, 'type' => $type, 'contents' => &$contents));\r
 \r
                // set IncludeMode properties of parser\r
                PARSER::setProperty('IncludeMode',$this->getIncludeMode());\r
@@ -251,7 +256,8 @@ class SKIN {
                                                                'set',\r
                                                                'if',\r
                                                                'else',\r
-                                                               'endif'\r
+                                                               'endif',\r
+                                                               'charset'\r
                                                                );\r
                \r
                // extra actions specific for a certain skin type\r
@@ -408,7 +414,7 @@ class ACTIONS extends BaseActions {
        */\r
        function doForm($filename) {\r
                global $DIR_NUCLEUS;\r
-               array_push($this->parser->actions,'formdata','text','callback','errordiv');\r
+               array_push($this->parser->actions,'formdata','text','callback','errordiv','ticket');\r
                $oldIncludeMode = PARSER::getProperty('IncludeMode');\r
                $oldIncludePrefix = PARSER::getProperty('IncludePrefix');\r
                PARSER::setProperty('IncludeMode','normal');\r
@@ -420,7 +426,14 @@ class ACTIONS extends BaseActions {
                array_pop($this->parser->actions);              // callback\r
                array_pop($this->parser->actions);              // text\r
                array_pop($this->parser->actions);              // formdata\r
+               array_pop($this->parser->actions);              // ticket\r
        }\r
+\r
+       function parse_ticket() {\r
+               global $manager;\r
+               $manager->addTicketHidden();\r
+       }\r
+\r
        function parse_formdata($what) {\r
                echo $this->formdata[$what];\r
        }\r
@@ -621,9 +634,23 @@ class ACTIONS extends BaseActions {
        }\r
 \r
        // include itemtitle of prev item\r
-       function parse_previtemtitle() {\r
+       function parse_previtemtitle($format = '') {\r
                global $itemtitleprev;\r
+               \r
+               switch ($format) {\r
+                       case 'xml':\r
+                               echo stringToXML ($itemtitleprev);\r
+                               break;\r
+                       case 'attribute':\r
+                               echo stringToAttribute ($itemtitleprev);\r
+                               break;\r
+                       case 'raw':\r
+                               echo $itemtitleprev;\r
+                               break;\r
+                       default:\r
                echo htmlspecialchars($itemtitleprev);\r
+                               break;\r
+               }\r
        }\r
 \r
        // include itemid of next item\r
@@ -633,9 +660,23 @@ class ACTIONS extends BaseActions {
        }\r
 \r
        // include itemtitle of next item\r
-       function parse_nextitemtitle() {\r
+       function parse_nextitemtitle($format = '') {\r
                global $itemtitlenext;\r
+\r
+               switch ($format) {\r
+                       case 'xml':\r
+                               echo stringToXML ($itemtitlenext);\r
+                               break;\r
+                       case 'attribute':\r
+                               echo stringToAttribute ($itemtitlenext);\r
+                               break;\r
+                       case 'raw':\r
+                               echo $itemtitlenext;\r
+                               break;\r
+                       default:\r
                echo htmlspecialchars($itemtitlenext);\r
+                               break;\r
+               }\r
        }\r
 \r
        function parse_prevarchive() {\r
@@ -767,6 +808,7 @@ class ACTIONS extends BaseActions {
        \r
        \r
        function parse_itemlink($linktext = '') {       \r
+               global $itemid;\r
                $this->_itemlink($itemid, $linktext);\r
        }\r
        \r
@@ -897,11 +939,24 @@ class ACTIONS extends BaseActions {
                $this->_postBlogContent('archivelist',$blog);\r
        }\r
 \r
-\r
-       function parse_itemtitle() {\r
+       function parse_itemtitle($format = '') {\r
                global $manager, $itemid;\r
                $item =& $manager->getItem($itemid,0,0);\r
+               \r
+               switch ($format) {\r
+                       case 'xml':\r
+                               echo stringToXML ($item['title']);\r
+                               break;\r
+                       case 'attribute':\r
+                               echo stringToAttribute ($item['title']);\r
+                               break;\r
+                       case 'raw':\r
+                               echo $item['title'];\r
+                               break;\r
+                       default:\r
                echo htmlspecialchars(strip_tags($item['title']));\r
+                               break;\r
+               }\r
        }\r
 \r
        function parse_categorylist($template, $blogname = '') {\r
@@ -1207,7 +1262,17 @@ class ACTIONS extends BaseActions {
                }\r
                \r
                if (!$destinationurl)\r
-                       $destinationurl = createItemLink($itemid, $this->linkparams);\r
+               {\r
+                       $destinationurl = createLink(\r
+                               'item', \r
+                               array(\r
+                                       'itemid' => $itemid,\r
+                                       'title' => $item['title'],\r
+                                       'timestamp' => $item['timestamp'],\r
+                                       'extra' => $this->linkparams\r
+                               )\r
+                       );\r
+               }\r
 \r
                // values to prefill\r
                $user = cookieVar($CONF['CookiePrefix'] .'comment_user');\r
@@ -1323,6 +1388,10 @@ class ACTIONS extends BaseActions {
        function parse_referer() {\r
                echo htmlspecialchars(serverVar('HTTP_REFERER'));\r
        }\r
+\r
+       function parse_charset() {\r
+               echo _CHARSET;\r
+       }\r
        \r
        /**\r
          * Helper function that sets the category that a blog will need to use \r
index 943f40f..f845d3d 100755 (executable)
@@ -1,6 +1,6 @@
 <?php\r
 \r
-/**\r
+/*\r
   * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/) \r
   * Copyright (C) 2002-2005 The Nucleus Group\r
   *\r
@@ -9,11 +9,14 @@
   * as published by the Free Software Foundation; either version 2\r
   * of the License, or (at your option) any later version.\r
   * (see nucleus/documentation/index.html#license for more info)\r
-  *\r
+ */\r
+/**\r
   * A class representing a template\r
   *\r
-  * $Id: TEMPLATE.php,v 1.3 2005-03-12 06:19:05 kimitake Exp $\r
-  * $NucleusJP$\r
+ * @license http://nucleuscms.org/license.txt GNU General Public License\r
+ * @copyright Copyright (C) 2002-2005 The Nucleus Group\r
+ * @version $Id: TEMPLATE.php,v 1.3.2.1 2005-08-25 07:04:14 kimitake Exp $\r
+ * @version $NucleusJP$\r
   */\r
 class TEMPLATE {\r
 \r
index 59c0429..40eed3d 100755 (executable)
@@ -1,5 +1,5 @@
 <?php\r
-/**\r
+/*\r
   * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/) \r
   * Copyright (C) 2002-2005 The Nucleus Group\r
   *\r
@@ -8,13 +8,16 @@
   * as published by the Free Software Foundation; either version 2\r
   * of the License, or (at your option) any later version.\r
   * (see nucleus/documentation/index.html#license for more info)\r
-  *\r
+ */\r
+/**\r
   * Scripts to create/restore a backup of the Nucleus database\r
   *\r
   * Based on code in phpBB (http://phpBB.sourceforge.net)\r
   *\r
-  * $Id: backup.php,v 1.3 2005-03-12 06:19:05 kimitake Exp $\r
-  * $NucleusJP$\r
+ * @license http://nucleuscms.org/license.txt GNU General Public License\r
+ * @copyright Copyright (C) 2002-2005 The Nucleus Group\r
+ * @version $Id: backup.php,v 1.3.2.1 2005-08-25 07:04:14 kimitake Exp $\r
+ * @version $NucleusJP: backup.php,v 1.3 2005/03/12 06:19:05 kimitake Exp $\r
   */\r
 \r
  \r
@@ -346,7 +349,7 @@ function _execute_queries($sql_query) {
 //                     debug("Executing: " . htmlspecialchars($sql) . "\n");\r
 \r
                        $result = mysql_query($sql);\r
-                       if (!$result) debug("SQL Error: " + mysql_error());\r
+                       if (!$result) debug('SQL Error: ' . mysql_error());\r
 \r
                }\r
        }\r
index 490e50a..793d0b7 100755 (executable)
@@ -1,6 +1,6 @@
 <?php\r
 \r
-/**\r
+/*\r
   * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
   * Copyright (C) 2002-2005 The Nucleus Group\r
   *\r
@@ -9,9 +9,12 @@
   * 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
-  * $Id: globalfunctions.php,v 1.5.2.2 2005-07-01 06:39:49 kimitake Exp $\r
-  * $NucleusJP: globalfunctions.php,v 1.5.2.1 2005/06/30 21:19:18 kimitake Exp $\r
+ */\r
+/**\r
+ * @license http://nucleuscms.org/license.txt GNU General Public License\r
+ * @copyright Copyright (C) 2002-2005 The Nucleus Group\r
+ * @version $Id: globalfunctions.php,v 1.5.2.3 2005-08-25 07:04:14 kimitake Exp $\r
+ * @version $NucleusJP: globalfunctions.php,v 1.5.2.2 2005/07/01 06:39:49 kimitake Exp $\r
   */\r
 \r
 // needed if we include globalfunctions from install.php\r
@@ -22,7 +25,7 @@ checkVars(array('nucleus', 'CONF', 'DIR_LIBS', 'MYSQL_HOST', 'MYSQL_USER', 'MYSQ
 \r
 $CONF['debug'] = 0;\r
 \r
-$nucleus['version'] = 'v3.21';\r
+$nucleus['version'] = 'v3.22';\r
 if (getNucleusPatchLevel() > 0)\r
 {\r
        $nucleus['version'] .= '/' . getNucleusPatchLevel();\r
@@ -49,7 +52,7 @@ $CONF['alertOnSecurityRisk'] = 1;
   * returns the currently used version (100 = 1.00, 101 = 1.01, etc...)\r
   */\r
 function getNucleusVersion() {\r
-       return 321;\r
+       return 322;\r
 }\r
 \r
 /**\r
@@ -156,10 +159,14 @@ if ($action == 'login') {
                        $action = $nextaction;\r
 \r
                $manager->notify('LoginSuccess',array('member' => &$member));\r
+               $errormessage = '';\r
                ACTIONLOG::add(INFO, "Login successful for $login (sharedpc=$shared)");\r
        } else {\r
+               // errormessage for [%errordiv%]\r
+               $errormessage = 'Login failed for ' . $login;\r
+               \r
                $manager->notify('LoginFailed',array('username' => $login));\r
-               ACTIONLOG::add(INFO, 'Login failed for ' . $login);\r
+               ACTIONLOG::add(INFO, $errormessage);\r
        }\r
 /*\r
 \r
@@ -202,8 +209,8 @@ Backed out for now: See http://forum.nucleuscms.org/viewtopic.php?t=3684 for det
 // login completed\r
 $manager->notify('PostAuthentication',array('loggedIn' => $member->isLoggedIn()));\r
 \r
-// first, let's see if the site is disabled or not\r
-if ($CONF['DisableSite'] && !$member->isAdmin()) {\r
+// first, let's see if the site is disabled or not. always allow admin area access.\r
+if ($CONF['DisableSite'] && !$member->isAdmin() && !$CONF['UsingAdminArea']) {\r
        redirect($CONF['DisableSiteURL']);\r
        exit;\r
 }\r
@@ -220,6 +227,7 @@ include($DIR_LIBS . 'NOTIFICATION.php');
 include($DIR_LIBS . 'BAN.php');\r
 include($DIR_LIBS . 'PAGEFACTORY.php');\r
 include($DIR_LIBS . 'SEARCH.php');\r
+include($DIR_LIBS . 'entity.php');\r
 \r
 \r
 // set lastVisit cookie (if allowed)\r
@@ -258,41 +266,64 @@ if (!defined('_ARCHIVETYPE_MONTH'))
 \r
 \r
 // decode path_info\r
-if ($CONF['URLMode'] == 'pathinfo') {\r
-       $data = explode("/",serverVar('PATH_INFO'));\r
-       for ($i=0;$i<sizeof($data);$i++) {\r
-               switch ($data[$i]) {\r
-                       case 'item':                    // item/1 (blogid)\r
-                               $i++;\r
-                               if ($i<sizeof($data)) $itemid = intval($data[$i]);\r
-                               break;\r
-                       case 'archives':                // archives/1 (blogid)\r
-                               $i++;\r
-                               if ($i<sizeof($data)) $archivelist = intval($data[$i]);\r
-                               break;\r
-                       case 'archive':                 // two possibilities: archive/yyyy-mm or archive/1/yyyy-mm (with blogid)\r
-                               if ((($i+1)<sizeof($data)) && (!strstr($data[$i+1],'-')) ){\r
-                                       $blogid = intval($data[++$i]);\r
-                               }\r
-                               $i++;\r
-                               if ($i<sizeof($data)) $archive = $data[$i];\r
-                               break;\r
-                       case 'blogid':                  // blogid/1\r
-                       case 'blog':                    // blog/1\r
-                               $i++;\r
-                               if ($i<sizeof($data)) $blogid = intval($data[$i]);\r
-                               break;\r
-                       case 'category':                // category/1 (catid)\r
-                       case 'catid':\r
-                               $i++;\r
-                               if ($i<sizeof($data)) $catid = intval($data[$i]);\r
-                               break;\r
-                       case 'member':\r
-                               $i++;\r
-                               if ($i<sizeof($data)) $memberid = intval($data[$i]);\r
-                               break;\r
-                       default:\r
-                               // skip...\r
+if ($CONF['URLMode'] == 'pathinfo')\r
+{\r
+       // initialize keywords if this hasn't been done before\r
+    if ($CONF['ItemKey'] == '')     $CONF['ItemKey'] = 'item';\r
+    if ($CONF['ArchiveKey'] == '')  $CONF['ArchiveKey'] = 'archive';\r
+    if ($CONF['ArchivesKey'] == '') $CONF['ArchivesKey'] = 'archives';\r
+    if ($CONF['MemberKey'] == '')   $CONF['MemberKey'] = 'member';\r
+    if ($CONF['BlogKey'] == '')     $CONF['BlogKey'] = 'blog';\r
+    if ($CONF['CategoryKey'] == '') $CONF['CategoryKey'] = 'category';\r
+        \r
+    $parsed = false;\r
+    $manager->notify(\r
+       'ParseURL', \r
+       array(\r
+               'type' => basename(serverVar('SCRIPT_NAME')),   // e.g. item, blog, ...\r
+               'info' => serverVar('PATH_INFO'),\r
+               'complete' => &$parsed          \r
+       )\r
+    );\r
+    \r
+    if (!$parsed)\r
+    {\r
+        // default implementation\r
+               $data = explode("/",serverVar('PATH_INFO'));\r
+               for ($i=0;$i<sizeof($data);$i++) {\r
+                       switch ($data[$i]) {\r
+                               case $CONF['ItemKey']:                  // item/1 (blogid)\r
+                                       $i++;\r
+                                       if ($i<sizeof($data)) $itemid = intval($data[$i]);\r
+                                       break;\r
+                               case $CONF['ArchivesKey']:              // archives/1 (blogid)\r
+                                       $i++;\r
+                                       if ($i<sizeof($data)) $archivelist = intval($data[$i]);\r
+                                       break;\r
+                               case $CONF['ArchiveKey']:               // two possibilities: archive/yyyy-mm or archive/1/yyyy-mm (with blogid)\r
+                                       if ((($i+1)<sizeof($data)) && (!strstr($data[$i+1],'-')) ){\r
+                                               $blogid = intval($data[++$i]);\r
+                                       }\r
+                                       $i++;\r
+                                       if ($i<sizeof($data)) $archive = $data[$i];\r
+                                       break;\r
+                               case 'blogid':                  // blogid/1\r
+                                       case $CONF['BlogKey']:  // blog/1\r
+                                       $i++;\r
+                                       if ($i<sizeof($data)) $blogid = intval($data[$i]);\r
+                                       break;\r
+                                       case $CONF['CategoryKey']:      // category/1 (catid)\r
+                               case 'catid':\r
+                                       $i++;\r
+                                       if ($i<sizeof($data)) $catid = intval($data[$i]);\r
+                                       break;\r
+                                       case $CONF['MemberKey']:\r
+                                       $i++;\r
+                                       if ($i<sizeof($data)) $memberid = intval($data[$i]);\r
+                                       break;\r
+                               default:\r
+                                       // skip...\r
+                       }\r
                }\r
        }\r
 }\r
@@ -352,7 +383,10 @@ function sendContentType($contenttype, $pagetype = '', $charset = _CHARSET) {
                $contenttype = preg_replace('|[^a-z0-9-+./]|i', '', $contenttype);\r
                $charset = preg_replace('|[^a-z0-9-_]|i', '', $charset);\r
                \r
-               header('Content-Type: ' . $contenttype . '; charset=' . $charset);                      \r
+               if ($charset != '')\r
+                       header('Content-Type: ' . $contenttype . '; charset=' . $charset);                      \r
+               else\r
+                       header('Content-Type: ' . $contenttype);                        \r
        }\r
        \r
        \r
@@ -366,7 +400,8 @@ function sendContentType($contenttype, $pagetype = '', $charset = _CHARSET) {
 function startUpError($msg, $title) {\r
        ?>\r
        <html xmlns="http://www.w3.org/1999/xhtml">\r
-               <head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title><?php echo htmlspecialchars($title)?></title></head>\r
+               <head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />\r
+               <title><?php echo htmlspecialchars($title)?></title></head>\r
                <body>\r
                        <h1><?php echo htmlspecialchars($title)?></h1>\r
                        <?php echo $msg?>\r
@@ -552,8 +587,8 @@ function selector() {
 \r
                global $itemidprev, $itemidnext, $catid, $itemtitlenext, $itemtitleprev;\r
 \r
-               // 1. get timestamp and blogid for item\r
-               $query = 'SELECT itime, iblog FROM '.sql_table('item').' WHERE inumber=' . intval($itemid);\r
+               // 1. get timestamp, blogid and catid for item\r
+               $query = 'SELECT itime, iblog, icat FROM '.sql_table('item').' WHERE inumber=' . intval($itemid);\r
                $res = sql_query($query);\r
                $obj = mysql_fetch_object($res);\r
 \r
@@ -581,6 +616,13 @@ function selector() {
                   else doError(_ERROR_NOSUCHITEM);\r
                }\r
 \r
+               // if a category has been selected which doesn't match the item, ignore the \r
+               // category. #85\r
+               if (($catid != 0) && ($catid != $obj->icat))\r
+               {\r
+                       $catid = 0;\r
+               }\r
+\r
                $blogid = $obj->iblog;\r
                $timestamp = strtotime($obj->itime);\r
 \r
@@ -599,7 +641,7 @@ function selector() {
        }\r
 \r
                // get next itemid and title\r
-               $query = 'SELECT inumber, ititle FROM '.sql_table('item').' WHERE itime>' . mysqldate($timestamp) . ' and itime <= ' . mysqldate(time()) . ' and idraft=0 and iblog=' . $blogid . $catextra . ' ORDER BY itime ASC LIMIT 1';\r
+               $query = 'SELECT inumber, ititle FROM '.sql_table('item').' WHERE itime>' . mysqldate($timestamp) . ' and itime <= ' . mysqldate($b->getCorrectTime()) . ' and idraft=0 and iblog=' . $blogid . $catextra . ' ORDER BY itime ASC LIMIT 1';\r
                $res = sql_query($query);\r
 \r
                $obj = mysql_fetch_object($res);\r
@@ -863,7 +905,7 @@ function getMailFooter() {
 function getLanguageName() {\r
        global $CONF, $member;\r
 \r
-       if ($member) {\r
+       if ($member && $member->isLoggedIn()) {\r
                // try to use members language\r
                $memlang = $member->getLanguage();\r
 \r
@@ -936,59 +978,99 @@ if (      ($CONF['URLMode'] == 'pathinfo')
   * Centralisation of the functions that generate links\r
   */\r
 function createItemLink($itemid, $extra = '') {\r
-       global $CONF;\r
-       if ($CONF['URLMode'] == 'pathinfo')\r
-               $link = $CONF['ItemURL'] . '/item/' . $itemid;\r
-       else\r
-               $link = $CONF['ItemURL'] . '?itemid=' . $itemid;\r
-       return addLinkParams($link, $extra);\r
+       return createLink('item', array('itemid' => $itemid));\r
 }\r
 function createMemberLink($memberid, $extra = '') {\r
-       global $CONF;\r
-       if ($CONF['URLMode'] == 'pathinfo')\r
-               $link = $CONF['MemberURL'] . '/member/' . $memberid;\r
-       else\r
-               $link = $CONF['MemberURL'] . '?memberid=' . $memberid;\r
-       return addLinkParams($link, $extra);\r
+       return createLink('member', array('memberid' => $memberid));\r
 }\r
 function createCategoryLink($catid, $extra = '') {\r
-       global $CONF;\r
-       if ($CONF['URLMode'] == 'pathinfo')\r
-               $link = $CONF['CategoryURL'] . '/category/' . $catid;\r
-       else\r
-               $link = $CONF['CategoryURL'] . '?catid=' . $catid;\r
-       return addLinkParams($link, $extra);\r
+       return createLink('category', array('catid' => $catid, 'extra' => $extra));\r
 }\r
 function createArchiveListLink($blogid = '', $extra = '') {\r
-       global $CONF;\r
-       if (!$blogid)\r
-               $blogid = $CONF['DefaultBlog'];\r
-       if ($CONF['URLMode'] == 'pathinfo')\r
-               $link = $CONF['ArchiveListURL'] . '/archives/' . $blogid;\r
-       else\r
-               $link = $CONF['ArchiveListURL'] . '?archivelist=' . $blogid;\r
-       return addLinkParams($link, $extra);\r
+       return createLink('archivelist', array('blogid' => $blogid, 'extra' => $extra));\r
 }\r
 function createArchiveLink($blogid, $archive, $extra = '') {\r
-       global $CONF;\r
-       if ($CONF['URLMode'] == 'pathinfo')\r
-               $link = $CONF['ArchiveURL'] . '/archive/'.$blogid.'/' . $archive;\r
-       else\r
-               $link = $CONF['ArchiveURL'] . '?blogid='.$blogid.'&amp;archive=' . $archive;\r
-       return addLinkParams($link, $extra);\r
-}\r
-function createBlogLink($url, $params) {\r
-       return addLinkParams($url . '?', $params);\r
+       return createLink('archive', array('blogid' => $blogid, 'archive' => $archive, 'extra' => $extra));\r
 }\r
 function createBlogidLink($blogid, $params = '') {\r
-       global $CONF;\r
-       if ($CONF['URLMode'] == 'pathinfo')\r
-               $link = $CONF['BlogURL'] . '/blog/' . $blogid;\r
-       else\r
-               $link = $CONF['BlogURL'] . '?blogid=' . $blogid;\r
-       return addLinkParams($link, $params);\r
+       return createLink('blog', array('blogid' => $blogid, 'extra' => $params));\r
 }\r
 \r
+function createLink($type, $params)\r
+{\r
+       global $manager, $CONF;\r
+       \r
+       $generatedURL = '';\r
+       $usePathInfo = ($CONF['URLMode'] == 'pathinfo');\r
+       \r
+       // ask plugins first\r
+       $created = false;\r
+       \r
+       if ($usePathInfo)\r
+       {\r
+               $manager->notify(\r
+                       'GenerateURL',\r
+                       array(\r
+                               'type' => $type,\r
+                               'params' => $params,\r
+                               'completed' => &$created,\r
+                               'url' => &$url\r
+                       )\r
+               );\r
+       } \r
+       \r
+       // if a plugin created the URL, return it\r
+       if ($created)\r
+               return $url;\r
+               \r
+       // default implementation\r
+       switch ($type)\r
+       {\r
+               case 'item':\r
+                       if ($usePathInfo)\r
+                               $url = $CONF['ItemURL'] . '/' . $CONF['ItemKey'] . '/' . $params['itemid'];\r
+                       else\r
+                               $url = $CONF['ItemURL'] . '?itemid=' . $params['itemid'];\r
+                       break;\r
+               case 'member':\r
+                       if ($usePathInfo)\r
+                               $url = $CONF['MemberURL'] . '/' . $CONF['MemberKey'] . '/' . $params['memberid'];\r
+                       else\r
+                               $url = $CONF['MemberURL'] . '?memberid=' . $params['memberid'];\r
+                       break;\r
+               case 'category':\r
+                       if ($usePathInfo)\r
+                               $url = $CONF['CategoryURL'] . '/' . $CONF['CategoryKey'] . '/' . $params['catid'];\r
+                       else\r
+                               $url = $CONF['CategoryURL'] . '?catid=' . $params['catid'];\r
+                       break;\r
+               case 'archivelist':\r
+                       if (!$params['blogid'])\r
+                               $params['blogid'] = $CONF['DefaultBlog'];\r
+                       if ($usePathInfo)\r
+                               $url = $CONF['ArchiveListURL'] . '/' . $CONF['ArchivesKey'] . '/' . $params['blogid'];\r
+                       else\r
+                               $url = $CONF['ArchiveListURL'] . '?archivelist=' . $params['blogid'];\r
+                       break;\r
+               case 'archive':\r
+                       if ($usePathInfo)\r
+                               $url = $CONF['ArchiveURL'] . '/' . $CONF['ArchiveKey'] . '/'.$params['blogid'].'/' . $params['archive'];\r
+                       else\r
+                               $url = $CONF['ArchiveURL'] . '?blogid='.$params['blogid'].'&amp;archive=' . $params['archive'];\r
+                       break;\r
+               case 'blog':\r
+                       if ($usePathInfo)\r
+                               $url = $CONF['BlogURL'] . '/' . $CONF['BlogKey'] . '/' . $params['blogid'];\r
+                       else\r
+                               $url = $CONF['BlogURL'] . '?blogid=' . $params['blogid'];\r
+                       break;\r
+       }       \r
+       \r
+       return addLinkParams($url, $params['extra']);\r
+}\r
+function createBlogLink($url, $params) {\r
+       return addLinkParams($url . '?', $params);\r
+}\r
 \r
 function addLinkParams($link, $params) {\r
        global $CONF;\r
@@ -1049,18 +1131,30 @@ function passVar($key, $value) {
 /*\r
        Date format functions (to be used from [%date(..)%] skinvars\r
 */\r
-function formatDate($format, $timestamp, $defaultFormat) {\r
-       if ($format == 'rfc822') { \r
-               return date('r', $timestamp); \r
-       } else if ($format == 'rfc822GMT') { \r
-               return gmdate('r', $timestamp); \r
-       } else if ($format == 'utc') { \r
-               return gmdate('Y-m-d\TH:i:s\Z', $timestamp); \r
-       } else if ($format == 'iso8601') {\r
-               $tz = date('O', $timestamp);\r
-        $tz = substr($tz, 0, 3) . ':' . substr($tz, 3, 2);     \r
-               return gmdate('Y-m-d\TH:i:s', $timestamp) . $tz;\r
-       } else {  \r
+function formatDate($format, $timestamp, $defaultFormat, &$blog) \r
+{\r
+       // apply blog offset (#42)\r
+       $boffset = $blog ? $blog->getTimeOffset() * 3600 : 0;\r
+       $offset = date('Z', $timestamp) + $boffset;\r
+\r
+       switch ($format) {\r
+               case 'rfc822' :\r
+                       if ($offset >= 0) $tz = '+';\r
+               else            { $tz = '-'; $offset = -$offset;}\r
+                       $tz .= sprintf("%02d%02d",floor($offset / 3600),round(($offset % 3600)/60));\r
+                       return date('D, j M Y H:i:s ', $timestamp) . $tz;\r
+               case 'rfc822GMT' :\r
+                       $timestamp -= $offset;\r
+                       return date('D, j M Y H:i:s ', $timestamp) . 'GMT';\r
+               case 'utc' :\r
+                       $timestamp -= $offset;\r
+                       return date('Y-m-d\TH:i:s\Z', $timestamp);\r
+               case 'iso8601' :\r
+                       if ($offset >= 0) $tz = '+';\r
+                       else            { $tz = '-'; $offset = -$offset;}\r
+                       $tz .= sprintf("%02d:%02d",floor($offset / 3600),round(($offset % 3600)/60));\r
+                       return date('Y-m-d\TH:i:s', $timestamp) . $tz;\r
+               default :\r
                return strftime($format ? $format : $defaultFormat,$timestamp); \r
        }  \r
 \r
@@ -1108,4 +1202,59 @@ function redirect($url)
        exit;\r
 }\r
 \r
+/**\r
+ * Strip HTML tags from a string\r
+ * This function is a bit more intelligent than a regular call to strip_tags(),\r
+ * because it also deletes the contents of certain tags and cleans up any \r
+ * unneeded whitespace.\r
+ */\r
+function stringStripTags ($string) {\r
+       $string = preg_replace("/<del[^>]*>.+<\/del[^>]*>/isU", '', $string);\r
+       $string = preg_replace("/<script[^>]*>.+<\/script[^>]*>/isU", '', $string);\r
+       $string = preg_replace("/<style[^>]*>.+<\/style[^>]*>/isU", '', $string);\r
+       $string = str_replace('>', '> ', $string);\r
+       $string = str_replace('<', ' <', $string);\r
+       $string = strip_tags($string);\r
+\r
+       $string = preg_replace("/\s+/", " ", $string);\r
+       $string = trim($string);\r
+       return $string;\r
+}\r
+\r
+/**\r
+ * Make a string containing HTML safe for use in a HTML attribute\r
+ * Tags are stripped and entities are normalized\r
+ */\r
+function stringToAttribute ($string) {\r
+       $string = stringStripTags($string);\r
+       $string = entity::named_to_numeric($string);\r
+       $string = entity::normalize_numeric($string);\r
+\r
+       if (_CHARSET == 'UTF-8') {\r
+               $string = entity::numeric_to_utf8($string);\r
+       }\r
+\r
+       $string = entity::specialchars($string, 'html');\r
+       $string = entity::numeric_to_named($string);\r
+       return $string;\r
+}\r
+\r
+/**\r
+ * Make a string containing HTML safe for use in a XML document\r
+ * Tags are stripped, entities are normalized and named entities are\r
+ * converted to numeric entities.\r
+ */\r
+function stringToXML ($string) {\r
+       $string = stringStripTags($string);\r
+       $string = entity::named_to_numeric($string);\r
+       $string = entity::normalize_numeric($string);\r
+               \r
+       if (_CHARSET == 'UTF-8') {\r
+               $string = entity::numeric_to_utf8($string);\r
+       }\r
+\r
+       $string = entity::specialchars($string, 'xml');\r
+       return $string;\r
+}\r
+\r
 ?>\r
index bd382e7..1728ba0 100755 (executable)
@@ -1,5 +1,5 @@
 <?php\r
-/**\r
+/*\r
   * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/) \r
   * Copyright (C) 2002-2005 The Nucleus Group\r
   *\r
@@ -8,12 +8,15 @@
   * as published by the Free Software Foundation; either version 2\r
   * of the License, or (at your option) any later version.\r
   * (see nucleus/documentation/index.html#license for more info)\r
-  *\r
+ */\r
+/**\r
   *    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-12 06:19:05 kimitake Exp $\r
-  * $NucleusJP$\r
+ * @license http://nucleuscms.org/license.txt GNU General Public License\r
+ * @copyright Copyright (C) 2002-2005 The Nucleus Group\r
+ * @version $Id: skinie.php,v 1.3.2.1 2005-08-25 07:04:14 kimitake Exp $\r
+ * @version $NucleusJP$\r
   */\r
 \r
 class SKINIMPORT {\r
index 1a38290..f179abd 100755 (executable)
@@ -1,6 +1,6 @@
 <?php\r
 \r
-/**\r
+/*\r
   * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/) \r
   * Copyright (C) 2002-2005 The Nucleus Group\r
   *\r
@@ -9,9 +9,12 @@
   * 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
-  * $Id: vars4.0.6.php,v 1.5 2005-03-12 06:19:05 kimitake Exp $\r
-  * $NucleusJP$\r
+ */\r
+/**\r
+ * @license http://nucleuscms.org/license.txt GNU General Public License\r
+ * @copyright Copyright (C) 2002-2005 The Nucleus Group\r
+ * @version $Id: vars4.0.6.php,v 1.5.2.1 2005-08-25 07:04:14 kimitake Exp $\r
+ * @version $NucleusJP: vars4.0.6.php,v 1.5 2005/03/12 06:19:05 kimitake Exp $\r
   */\r
   \r
 /**\r
index bc45131..801ab42 100755 (executable)
@@ -1,6 +1,6 @@
 <?php\r
 \r
-/**\r
+/*\r
   * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/) \r
   * Copyright (C) 2002-2005 The Nucleus Group\r
   *\r
@@ -9,9 +9,12 @@
   * 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
-  * $Id: vars4.1.0.php,v 1.5 2005-03-12 06:19:05 kimitake Exp $\r
-  * $NucleusJP$\r
+ */\r
+/**\r
+ * @license http://nucleuscms.org/license.txt GNU General Public License\r
+ * @copyright Copyright (C) 2002-2005 The Nucleus Group\r
+ * @version $Id: vars4.1.0.php,v 1.5.2.1 2005-08-25 07:04:14 kimitake Exp $\r
+ * @version $NucleusJP: vars4.1.0.php,v 1.5 2005/03/12 06:19:05 kimitake Exp $\r
   */\r
   \r
 function getVar($name) {\r
index df3dce7..0fdeef8 100755 (executable)
@@ -1,8 +1,8 @@
 <?php                                  // -*-c++-*-\r
 // by Edd Dumbill (C) 1999-2002\r
 // <edd@usefulinc.com>\r
-// $Id: xmlrpc.inc.php,v 1.4.4.2 2005-08-16 05:26:18 kimitake Exp $\r
-// $NucleusJP: xmlrpc.inc.php,v 1.4.2.2 2005/07/03 05:16:44 kimitake Exp $\r
+// $Id: xmlrpc.inc.php,v 1.4.4.3 2005-08-25 07:04:14 kimitake Exp $\r
+// $NucleusJP: xmlrpc.inc.php,v 1.4.2.4 2005/08/23 08:08:38 kimitake Exp $\r
 \r
 // Copyright (c) 1999,2000,2002 Edd Dumbill.\r
 // All rights reserved.\r
 </member>\r
 <member>\r
 <name>faultString</name>\r
-<value><string>' . xmlrpc_encode_entitites($this->errstr) . '</string></value>\r
+<value><string>' . mb_convert_encoding(xmlrpc_encode_entitites($this->errstr), $xmlrpc_defencoding, _CHARSET) . '</string></value>\r
 </member>\r
 </struct>\r
 </value>\r
                {\r
                        $rs='';\r
                        global $xmlrpcTypes, $xmlrpcBase64, $xmlrpcString,\r
-                       $xmlrpcBoolean;\r
+                       $xmlrpcBoolean, $xmlrpc_defencoding;\r
                        switch(@$xmlrpcTypes[$typ])\r
                        {\r
                                case 3:\r
                                                        // $rs.="<${typ}>" . htmlentities($val). "</${typ}>";\r
                                                        \r
                                                        // N. Leenheer 2005/6/30: Use CDATA instead... \r
-                                                       $rs.="<${typ}><![CDATA[" . $val. "]]></${typ}>";\r
+                                                       $rs.="<${typ}><![CDATA[" . mb_convert_encoding($val, $xmlrpc_defencoding, _CHARSET). "]]></${typ}>";\r
                                                        break;\r
                                                default:\r
                                                        $rs.="<${typ}>${val}</${typ}>";\r
index 2ed5961..a68f637 100755 (executable)
@@ -1,5 +1,5 @@
 <?php\r
-/**\r
+/*\r
   * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/) \r
   * Copyright (C) 2002-2005 The Nucleus Group\r
   *\r
@@ -8,7 +8,8 @@
   * as published by the Free Software Foundation; either version 2\r
   * of the License, or (at your option) any later version.\r
   * (see nucleus/documentation/index.html#license for more info)\r
-  *\r
+ */\r
+/**\r
   * Media popup window for Nucleus\r
   *\r
   * Purpose:\r
   *   - close the popup by selecting a file in the list. The file gets\r
   *     passed through to the add-item form (linkto, popupimg or inline img)\r
   *\r
-  * $Id: media.php,v 1.4 2005-03-16 07:55:04 kimitake Exp $\r
-  * $NucleusJP$\r
+ * @license http://nucleuscms.org/license.txt GNU General Public License\r
+ * @copyright Copyright (C) 2002-2005 The Nucleus Group\r
+ * @version $Id: media.php,v 1.4.2.1 2005-08-25 07:04:13 kimitake Exp $\r
+ * @version $NucleusJP: media.php,v 1.4 2005/03/16 07:55:04 kimitake Exp $\r
+ *\r
   */\r
   \r
 $CONF = array();\r
index d6136a9..779db57 100644 (file)
@@ -1,34 +1,48 @@
 <?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
+class NP_SkinFiles extends NucleusPlugin {\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
+       * Nucleus SkinFiles Plugin\r
+       *\r
+       * Copyright 2005 by Jeff MacMichael and Niels Leenheer\r
+       * ==========================================================================================\r
+       * This program is free software and open source software; you can redistribute\r
+       * it and/or modify it under the terms of the GNU General Public License as\r
+       * published by the Free Software Foundation; either version 2 of the License,\r
+       * or (at your option) any later version.\r
+       *\r
+       * This program is distributed in the hope that it will be useful, but WITHOUT\r
+       * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\r
+       * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for\r
+       * more details.\r
+       *\r
+       * You should have received a copy of the GNU General Public License along\r
+       * with this program; if not, write to the Free Software Foundation, Inc.,\r
+       * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA  or visit\r
+       * http://www.gnu.org/licenses/gpl.html\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
+       * v2.00 rakaz - Almost complete rewrite\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 getName()                { return 'SkinFiles'; }\r
+       function getAuthor()      { return 'Misc authors'; }\r
+       function getURL()                 { return 'http://www.nucleuscms.org/'; }\r
+       function getVersion()     { return '2.0'; }\r
        function getDescription() { return 'A simple file manager for skins.';  }\r
 \r
        function supportsFeature($what) {\r
@@ -54,14 +68,11 @@ class NP_SkinFiles extends NucleusPlugin {
        }\r
        \r
        function event_QuickMenu(&$data) {\r
-               global $member, $nucleus, $blogid;\r
+               global $member;\r
+\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
+               if (!($member->isLoggedIn() && $member->isAdmin())) return;\r
+\r
                array_push(\r
                        $data['options'], \r
                        array(\r
@@ -72,4 +83,5 @@ class NP_SkinFiles extends NucleusPlugin {
                );\r
        }\r
 }\r
+\r
 ?>
\ No newline at end of file
index 7b37b09..4b8ac3b 100644 (file)
Binary files a/utf8/nucleus/plugins/skinfiles/dir.gif and b/utf8/nucleus/plugins/skinfiles/dir.gif differ
index a5c40f1..a9cbcd7 100644 (file)
Binary files a/utf8/nucleus/plugins/skinfiles/image.gif and b/utf8/nucleus/plugins/skinfiles/image.gif differ
index a23e3ee..626cad5 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
+   /* ==========================================================================================\r
+       * Nucleus SkinFiles Plugin\r
+       *\r
+       * Copyright 2005 by Jeff MacMichael and Niels Leenheer\r
+       * ==========================================================================================\r
+       * This program is free software and open source software; you can redistribute\r
+       * it and/or modify it under the terms of the GNU General Public License as\r
+       * published by the Free Software Foundation; either version 2 of the License,\r
+       * or (at your option) any later version.\r
+       *\r
+       * This program is distributed in the hope that it will be useful, but WITHOUT\r
+       * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\r
+       * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for\r
+       * more details.\r
+       *\r
+       * You should have received a copy of the GNU General Public License along\r
+       * with this program; if not, write to the Free Software Foundation, Inc.,\r
+       * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA  or visit\r
+       * http://www.gnu.org/licenses/gpl.html\r
+       * ==========================================================================================\r
+       */\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
+       \r
+\r
+       /**\r
+         * Create admin area\r
+         */\r
+\r
+       $oPluginAdmin  = new PluginAdmin('SkinFiles');\r
+\r
+       if (!($member->isLoggedIn() && $member->isAdmin()))\r
+       {\r
                $oPluginAdmin->start();\r
-               echo "<p>"._ERROR_DISALLOWED."</p>";\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
        \r
-       global $pluginsskinfiles, $CONF;\r
-       $pluginsskinfiles=$CONF['PluginURL']."skinfiles";\r
+       /**\r
+         * Setup main variables\r
+         */\r
 \r
-       if (isset($_GET['action'])) {$action = $_GET['action'];}\r
-       if (isset($_POST['action'])) {$action = $_POST['action'];}\r
+       $rootDirectory = sfRealPath($DIR_SKINS);                        \r
+       $rootUrl       = $CONF['SkinsURL'];\r
+       $pluginUrl         = $oPluginAdmin->plugin->getAdminURL();\r
+\r
+       $filetypes = array (\r
+               'text'  => array ('inc', 'txt', 'css', 'js', 'php'),\r
+               'html'  => array ('htm', 'html'),\r
+               'img'   => array ('png', 'gif', 'jpg', 'jpeg', 'bmp', 'ico', 'swf'),\r
+       );\r
+       \r
+       \r
+       /**\r
+         * Bypass admin area for downloads\r
+         */\r
+       \r
+       $action = requestVar('action');\r
 \r
        if ($action == 'download') { \r
-               download();\r
-               return;\r
-               break;\r
+               _skinfiles_download();\r
+               exit;\r
        }\r
 \r
-       // create the admin area page\r
-       $oPluginAdmin = new PluginAdmin('SkinFiles');\r
-       $oPluginAdmin->start();\r
+\r
+       /**\r
+         * Build admin area\r
+         */\r
+\r
+       $oPluginAdmin->start("<style type='text/css'>\r
+       <!--\r
+       \r
+               div#content a {\r
+                       text-decoration: none;\r
+               }\r
+               div#content img {\r
+                       vertical-align: middle;\r
+                       margin-top: -3px;\r
+               }\r
+               p.message {\r
+                       font-weight: bold;\r
+               }\r
+               p.error {\r
+                       font-size: 100%;\r
+                       font-weight: bold;\r
+                       color: #880000;\r
+               }\r
+               pre {\r
+                       overflow: auto;\r
+                       height: 400px;\r
+               }\r
+               iframe {\r
+                       width: 100%;\r
+                       height: 400px;\r
+                       border: 1px solid gray;\r
+               }\r
+               div.dialogbox {\r
+                       border: 1px solid #ddd;\r
+                       background-color: #F6F6F6;\r
+                       margin: 18px 0 1.5em 0;\r
+               }\r
+               div.dialogbox h4 {\r
+                       background-color: #bbc;\r
+                       color: #000;\r
+                       margin: 0;\r
+                       padding: 5px;\r
+               }\r
+               div.dialogbox h4.light {\r
+                       background-color: #ddd;\r
+               }\r
+               div.dialogbox div {\r
+                       margin: 0;\r
+                       padding: 10px;\r
+               }\r
+               div.dialogbox button {\r
+                       margin: 10px 0 0 6px;\r
+                       float: right;\r
+               }\r
+               div.dialogbox p {\r
+                       margin: 0;\r
+               }\r
+               div.dialogbox p.buttons {\r
+                       text-align: right;\r
+                       overflow: auto;\r
+               }\r
+               div.dialogbox textarea {\r
+                       width: 100%;\r
+                       margin: 0;\r
+               }\r
+       \r
+       -->\r
+       </style>");\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
+       $actions = array (\r
+               'renfile', 'renfile_process', 'delfile', 'delfile_process', \r
+               'editfile', 'editfile_process', 'uploadfile', 'createfile', 'viewfile',\r
+               'rendir', 'rendir_process', 'deldir', 'deldir_process',\r
+               'emptydir', 'emptydir_process', 'createdir'\r
+       );\r
+       \r
+       if (in_array($action, $actions)) \r
+       { \r
+               if (!$manager->checkTicket())\r
+               {\r
+                       echo '<p class="error">Error: ' . _ERROR_BADTICKET . '</p>';\r
+                       sfShowDirectory();\r
+                       \r
+               } \r
+               else \r
+               {\r
+                       call_user_func('_skinfiles_' . $action);\r
+               }\r
+       } \r
+       else \r
+       {\r
+               sfShowDirectory();\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
+       exit;\r
+       \r
+       \r
+\r
+\r
+\r
+\r
+\r
+       /* Helper functions **************************************************************************************************************/\r
+\r
+       function sfExpandDirectory ($path) {\r
+          /* IN:  relative directory\r
+               * OUT: full path to directory\r
+               */\r
+\r
+               global $rootDirectory;\r
+               return sfRealPath($rootDirectory . $path);\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
+       function sfRealPath ($path) {\r
+          /* IN:  full path \r
+               * OUT: canonicalized absolute pathname\r
+               */\r
+\r
+               $path = realpath($path);\r
+               $path = str_replace('\\', '/', $path);  \r
+               $path = substr($path, strlen($path) - 1) != '/' ? $path . '/' : $path;\r
+               return $path;\r
+       }\r
+\r
+       function sfFullUrl ($path) {\r
+          /* IN:  full path including filename\r
+               * OUT: url including filename\r
+               */\r
+\r
+               global $rootDirectory, $rootUrl;\r
                \r
-               if ($filesize > $CONF['MaxUploadSize']) {\r
-                       showdir(_ERROR_FILE_TOO_BIG);\r
-                       return;\r
-               }\r
+               $path = str_replace($rootDirectory, '', $path);\r
+               $path = rawurlencode($path);\r
+               $path = str_replace('%2F', '/', $path);\r
+               return $rootUrl . $path;\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
+       function sfValidPath ($path) {\r
+          /* IN:  full path excluding or including filename\r
+               * OUT: boolean, true if full path is or is within rootDirectory\r
+               */\r
+\r
+               global $rootDirectory;\r
+               return substr($path, 0, strlen($rootDirectory)) == $rootDirectory;\r
+       }\r
+       \r
+       function sfRelativePath ($path) {\r
+          /* IN:  full path including or excluding filename\r
+               * OUT: relative path from rootDirectory\r
+               */\r
+\r
+               global $rootDirectory;\r
+               return str_replace($rootDirectory, '', $path);\r
+       }\r
+       \r
+       function sfIsFileType ($type, $file) {\r
+\r
+               global $filetypes;\r
+               return isset($filetypes[$type]) && in_array(strtolower(substr(strrchr($file, "."), 1)), $filetypes[$type]);\r
+       }\r
+\r
+       function sfAllowEditing ($file) {\r
+               return sfIsFileType('html', $file) || sfIsFileType('text', $file);\r
+       }\r
+       \r
+       function sfAllowViewing ($file) {\r
+               return sfIsFileType('html', $file) || sfIsFileType('text', $file) || sfIsFileType('img', $file);\r
+       }\r
+\r
+\r
+       function sfDisplayPath ($relative) {\r
+       \r
+               global $pluginUrl;\r
+               \r
+               $result  = '<a href="' . htmlspecialchars($pluginUrl) . '" title="Go back to &laquo;skins&raquo;">';\r
+               $result .= '<img src="' . htmlspecialchars($pluginUrl . 'home.gif') . '" alt="" /> skins</a> / ';\r
+\r
+               $parts = explode('/', $relative);\r
+               $part = '';\r
+               \r
+               while (list(,$v) = each ($parts)) {\r
+                       if ($v != '') {\r
+                               $part .= $v . '/';\r
+                               \r
+                               $result .= '<a href="' . htmlspecialchars($pluginUrl . '?dir=' . rawurlencode($part)) . '" ';\r
+                               $result .= 'title="Go back to &laquo;' . htmlspecialchars($v) . '&raquo;">';\r
+                               $result .= '<img src="' . htmlspecialchars($pluginUrl . 'dir.gif') . '" alt="" /> ';\r
+                               $result .= htmlspecialchars($v) . '</a> / ';\r
+                       }\r
                }\r
-               if (!is_uploaded_file($filetempname)) {\r
-                       showdir(_ERROR_BADREQUEST);\r
-                       return;\r
+               \r
+               return $result;\r
+       }\r
+\r
+       function sfIcon ($file) {\r
+       \r
+               global $pluginUrl;\r
+       \r
+               $ext = strtolower(substr(strrchr($file, "."), 1));\r
+               \r
+               switch ($ext) {\r
+                       case 'htm':\r
+                       case 'html':\r
+                               return $pluginUrl . 'html.gif';\r
+                               break;\r
+\r
+                       case 'txt':\r
+                       case 'js':\r
+                       case 'css':\r
+                       case 'inc':\r
+                               return $pluginUrl . 'text.gif';\r
+                               break;\r
+\r
+                       case 'gif':\r
+                       case 'png':\r
+                       case 'jpg':\r
+                       case 'jpeg':\r
+                       case 'bmp':\r
+                       case 'xbmp':\r
+                       case 'ico':\r
+                               return $pluginUrl . 'image.gif';\r
+                               break;\r
+\r
+                       case 'php':\r
+                       case 'php3':\r
+                       case 'php4':\r
+                               return $pluginUrl . 'php.gif';\r
+                               break;\r
+                               \r
+                       default:\r
+                               return $pluginUrl . 'generic.gif';\r
+                               break;\r
                }\r
-               if (file_exists($todir.$filename)) {\r
-                       showdir(_ERROR_UPLOADDUPLICATE);\r
-                       return;\r
+       }\r
+\r
+       function sfIllegalFilename($name) {\r
+               return preg_match('#[\n\r\\\/\:\*\?\"\<\>\|]#', $name);\r
+       }\r
+\r
+       function sfDirectoryIsEmpty($dir) {\r
+               \r
+               $count = 0;\r
+               \r
+               if ($dh = opendir($dir)) \r
+               {\r
+                       while (($file = readdir($dh)) !== false) \r
+                               $count++;\r
+                       \r
+                       closedir($dh);\r
                }\r
+               \r
+               // $count must be smaller or equal than 2, because '.' \r
+               // and '..' are always returned by readdir().\r
+               return $count <= 2;\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
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+       /* Show directory ****************************************************************************************************************/\r
+\r
+       function sfShowDirectory($default = '') {\r
+\r
+               global $pluginUrl, $rootDirectory, $CONF, $manager;\r
+               \r
+               $directory = $default != '' ? \r
+                       $default : \r
+                       sfExpandDirectory(trim(requestVar('dir')));\r
+               \r
+               if (!sfValidPath($directory) || !is_dir($directory)) {\r
+                       $directory = $rootDirectory;\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
+               $relative  = sfRelativePath ($directory);\r
+               \r
+               echo '<p class="location">Current location: ' . sfDisplayPath($relative) . '</p>';                      \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
+               $dirs = array();\r
+               $files = array();\r
+\r
+               if ($dh = @opendir($directory)) { \r
+                       while (($file = readdir($dh)) !== false) { \r
+                               if (!preg_match("/^\.{1,2}$/", $file)) {\r
+                                       $fstat = @stat($directory . $file);\r
+                               \r
+                                       if ($fstat['mode'] & 040000)\r
+                                               $dirs[$file] = $fstat;\r
+                                       else\r
+                                               $files[$file] = $fstat;\r
                                }\r
-                       } else {\r
-                               $success = false;\r
                        }\r
-                       error_reporting($errrep);\r
-                       if ($success) {\r
-                               $msg = 'File was edited successfully.';\r
+                       closedir($dh); \r
+               }                       \r
+               \r
+               ksort($dirs);\r
+               ksort($files);\r
+               \r
+               echo '<table><thead><tr>';\r
+               echo '<th>Name</th><th>Size</th><th>Last modified</th><th colspan="4">Actions</th>';\r
+               echo '</tr></thead>';\r
+\r
+               while (list($name, $stat) = each($dirs)) {\r
+                       \r
+                       $dir = sfRelativePath($directory . $name . '/');\r
+                               \r
+                       echo '<tr onmouseover="focusRow(this);" onmouseout="blurRow(this);"><td>';\r
+                       \r
+                       if (is_readable ($directory . $name)) \r
+                       {\r
+                               echo '<a href="' . htmlspecialchars($pluginUrl . '?dir=' . rawurlencode($dir)) . '">';\r
+                               echo '<img src="' . htmlspecialchars($pluginUrl . 'dir.gif') . '" alt="folder" /> ';\r
+                               echo htmlspecialchars($name).'</a>';                    \r
+                       }\r
+                       else\r
+                       {\r
+                               echo '<img src="' . htmlspecialchars($pluginUrl . 'dir.gif') . '" alt="folder" /> ';\r
+                               echo htmlspecialchars($name);                   \r
+                       }\r
+                                               \r
+                       echo '</td>';\r
+                               \r
+                       $renUrl = $manager->addTicketToUrl($pluginUrl . '?action=rendir&dir=' . rawurlencode($dir));\r
+                       $delUrl = $manager->addTicketToUrl($pluginUrl . '?action=deldir&dir=' . rawurlencode($dir));\r
+                               \r
+                       echo '<td>&ndash;</td>';\r
+                       echo '<td>' . date('M d Y, H:i', $stat['mtime']);\r
+                       \r
+                       \r
+                       if (is_writable($directory . $name)) {\r
+                               echo '<td><a href="' . htmlspecialchars($renUrl) . '" title="Rename &laquo;' . htmlspecialchars($name) . '&raquo;">Rename</a></td>';\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
+                               echo '<td>&nbsp;</td>';\r
+                       }\r
+                       \r
+                       if (is_writable($directory . $name) && sfDirectoryIsEmpty($directory . $name)) {\r
+                               echo '<td><a href="' . htmlspecialchars($delUrl) . '" title="Delete &laquo;' . htmlspecialchars($name) . '&raquo;">Delete</a></td>';\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
+                               echo '<td>&nbsp;</td>';\r
+                       }\r
+                       \r
+                       echo '<td>&nbsp;</td><td>&nbsp;</td>';\r
+                       echo '</tr>';\r
+               }\r
+\r
+\r
+               while (list($name, $stat) = each($files)) {\r
+\r
+                       $file = sfRelativePath($directory . $name);\r
+\r
+                       $renUrl   = $manager->addTicketToUrl($pluginUrl . '?action=renfile&file='  . rawurlencode($file));\r
+                       $delUrl   = $manager->addTicketToUrl($pluginUrl . '?action=delfile&file='  . rawurlencode($file));\r
+                       $editUrl  = $manager->addTicketToUrl($pluginUrl . '?action=editfile&file=' . rawurlencode($file));\r
+                       $viewUrl  = $manager->addTicketToUrl($pluginUrl . '?action=viewfile&file=' . rawurlencode($file));\r
+                       $dlUrl    = $manager->addTicketToUrl($pluginUrl . '?action=download&file=' . rawurlencode($file));\r
+\r
+                       echo '<tr onmouseover="focusRow(this);" onmouseout="blurRow(this);"><td>';\r
+                       \r
+                       if (is_readable ($directory . $name) && sfAllowViewing($name)) \r
+                       {\r
+                               echo '<a href="' . htmlspecialchars($viewUrl) . '">';\r
+                               echo '<img src="' . htmlspecialchars(sfIcon($name)) . '" alt="" /> ';\r
+                               echo htmlspecialchars($name).'</a>';\r
+                       }\r
+                       else\r
+                       {\r
+                               echo '<img src="' . htmlspecialchars(sfIcon($name)) . '" alt="" /> ';\r
+                               echo htmlspecialchars($name);\r
+                       }\r
+\r
+                       echo '</td><td>';\r
+                       echo ceil($stat['size'] / 1024) . ' kB';\r
+                       echo '</td><td>';\r
+                       echo date('M d Y, H:i', $stat['mtime']);\r
+                       echo '</td><td>';\r
+                               \r
+                       if (is_writable($directory . $name)) {\r
+                               echo '<a href="' . htmlspecialchars($renUrl) . '" title="Rename &laquo;' . htmlspecialchars($name) . '&raquo;">Rename</a>';\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
+                               echo '&nbsp;';\r
+                       }\r
+                               \r
+                       echo '</td><td>';\r
+\r
+                       if (is_writable($directory . $name)) {\r
+                               echo '<a href="' . htmlspecialchars($delUrl) . '" title="Delete &laquo;' . htmlspecialchars($name) . '&raquo;">Delete</a>';\r
                        } else {\r
-                               $msg = 'ERROR: directory "'.$_GET["remdir"].'" could not be deleted - (check to see if it contains files).';\r
+                               echo '&nbsp;';\r
+                       }\r
+                               \r
+                       echo '</td><td>';\r
+                       \r
+                       if (is_writable($directory . $name) && sfAllowEditing($name))\r
+                               echo '<a href="'. htmlspecialchars($editUrl) . '" title="Edit &laquo;' . htmlspecialchars($name) . '&raquo;">Edit</a>';\r
+                       else\r
+                               echo '&nbsp;';\r
+\r
+                       echo '</td><td>';\r
+                       \r
+                       if (is_readable ($directory . $name))\r
+                               echo '<a href="' . htmlspecialchars($dlUrl) . '" title="Download &laquo;' . htmlspecialchars($name) . '&raquo;">Download</a>';\r
+                       else\r
+                               echo '&nbsp;';\r
+                               \r
+                       echo '</td></tr>';\r
+               }\r
+\r
+               if (!count($dirs) && !count($files)) {\r
+                       echo '<tr><td colspan="7">This directory does not contain any files or directories</td></tr>';\r
+               }\r
+\r
+               echo '</table>';\r
+\r
+               if ($relative != '') {\r
+               \r
+                       if (is_writable($directory)) {\r
+                               echo '<div class="dialogbox">';\r
+                               echo '<h4 class="light">Create a new file</h4><div>';\r
+                               echo '<form method="post" action="' . htmlspecialchars($pluginUrl) . '">';\r
+                               $manager->addTicketHidden();\r
+                               echo '<input type="hidden" name="action" value="createfile" />';\r
+                               echo '<input type="hidden" name="dir" value="' . htmlspecialchars($relative) . '" />';\r
+                               echo '<input type="text" name="name" size="40" value="untitled.txt" />';\r
+                               echo '<p class="buttons"><input type="submit" value="Create file" /></p></form>';\r
+                               echo '</div></div>';\r
+       \r
+                               echo '<div class="dialogbox">';\r
+                               echo '<h4 class="light">Upload new file</h4><div>';\r
+                               echo '<form method="post" enctype="multipart/form-data" action="' . htmlspecialchars($pluginUrl) . '">';\r
+                               $manager->addTicketHidden();\r
+                               echo '<input type="hidden" name="action" value="uploadfile" />';\r
+                               echo '<input type="hidden" name="dir" value="' . htmlspecialchars($relative) . '" />';\r
+                               echo '<input type="hidden" name="MAX_FILE_SIZE" value="' . $CONF['MaxUploadSize'] . '" />';\r
+                               echo '<input type="file" name="name" size="40" />';\r
+                               echo '<p class="buttons"><input type="submit" value="Upload" /></p></form>';\r
+                               echo '</div></div>';\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
+                       if (count($files)) {\r
+                               echo '<div class="dialogbox">';\r
+                               echo '<h4 class="light">Delete all files in this directory</h4><div>';\r
+                               echo '<form method="post" action="' . htmlspecialchars($pluginUrl) . '">';\r
+                               $manager->addTicketHidden();\r
+                               echo '<input type="hidden" name="action" value="emptydir" />';\r
+                               echo '<input type="hidden" name="dir" value="' . htmlspecialchars($relative) . '" />';\r
+                               echo 'Delete all files? (will ask for confirmation)';\r
+                               echo '<p class="buttons"><input type="submit" value="Delete All" tabindex="140" onclick="return checkSubmit();" /></p>';\r
+                               echo '</form>';\r
+                               echo '</div></div>';\r
+                       }\r
+               }\r
+       \r
+               if (is_writable($directory)) {\r
+                       echo '<div class="dialogbox">';\r
+                       echo '<h4 class="light">Create a new directory</h4><div>';\r
+                       echo '<form method="post" action="' . htmlspecialchars($pluginUrl) . '">';\r
+                       $manager->addTicketHidden();\r
+                       echo '<input type="hidden" name="action" value="createdir" />';\r
+                       echo '<input type="hidden" name="dir" value="' . htmlspecialchars($relative) . '" />';\r
+                       echo '<input type="text" name="name" value="untitled" tabindex="90" size="40" />';\r
+                       echo '<p class="buttons"><input type="submit" value="Create" tabindex="140" onclick="return checkSubmit();" /></p>';\r
+                       echo '</form>';\r
+                       echo '</div></div>';\r
                }\r
        }\r
+       \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
+       /* Rename directory **************************************************************************************************************/\r
+\r
+       function _skinfiles_rendir($preset = '') {\r
+\r
+               global $pluginUrl, $manager;\r
+               \r
+               $file      = trim(basename(requestVar('dir')));\r
+               $directory = trim(dirname(requestVar('dir')));\r
+               $directory = sfExpandDirectory ($directory);\r
+               \r
+               if (sfValidPath($directory . $file) && file_exists($directory . $file) && \r
+                       is_dir($directory . $file) && is_writable($directory . $file)) \r
+               {\r
+                       $relative = sfRelativePath ($directory);\r
+                       $editUrl  = $manager->addTicketToUrl($pluginUrl . '?action=rendir&dir=' . rawurlencode($relative . $file));\r
+\r
+                       echo '<p class="location">Current location: ' . sfDisplayPath($relative);\r
+                       echo '<a href="' . htmlspecialchars($editUrl) . '" title="Rename &laquo;' . $file . '&raquo;">';\r
+                       echo '<img src="' . $pluginUrl . 'dir.gif' . '" alt="" /> ' . $file . '</a></p>';\r
+\r
+                       echo '<div class="dialogbox">';\r
+                       echo '<form method="post" action="' . htmlspecialchars($pluginUrl) . '">';\r
+                       $manager->addTicketHidden();\r
+                       echo '<input type="hidden" name="action" value="rendir_process" />';\r
+                       echo '<input type="hidden" name="dir" value="' . htmlspecialchars($relative . $file) . '" />';\r
+\r
+                       echo '<h4>Rename directory &laquo;' . htmlspecialchars($file) . '&raquo; to:</h4><div>';\r
+                       echo '<p><input type="text" name="name" size="40" value="' . htmlspecialchars($preset != '' ? $preset : $file) . '" /></p>';\r
+                       echo '<p class="buttons"><button name="sure" value="yes" onclick="return checkSubmit();">Rename</button>';\r
+                       echo '<button name="sure" value="no">Cancel</button></p></div>';\r
+                       echo '</form>';\r
+                       echo '</div>';\r
+               }\r
+               else\r
+               {\r
+                       echo "<p class='error'>Error: The directory &laquo;" . htmlspecialchars($file) . "&raquo;  does not exist ";\r
+                       echo "or you do not have permission to rename the directory</p>";\r
+               }\r
+       }\r
+       \r
+       function _skinfiles_rendir_process() {\r
+\r
+               global $pluginUrl, $manager;\r
+               \r
+               $file      = trim(basename(requestVar('dir')));\r
+               $directory = trim(dirname(requestVar('dir')));\r
+               $directory = sfExpandDirectory ($directory);\r
+               \r
+               if (requestVar('sure') == 'yes')\r
+               {\r
+                       if (sfValidPath($directory . $file) && file_exists($directory . $file) && \r
+                               is_dir($directory . $file) && is_writable($directory . $file)) \r
+                       {\r
+                               $name = requestVar('name');\r
+                               \r
+                               if ($name == '') {\r
+                                       echo "<p class='error'>Error: Could not rename the directory &laquo;" . htmlspecialchars($file) . "&raquo; ";\r
+                                       echo "because no new name was supplied.</p>";\r
+                                       _skinfiles_rendir($name);\r
+                                       return;\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
+                               if (sfIllegalFilename($name)) {\r
+                                       echo "<p class='error'>Error: Could not rename the directory &laquo;" . htmlspecialchars($file) . "&raquo; ";\r
+                                       echo "because the supplied name contains one or more illegal characters</p>";\r
+                                       _skinfiles_rendir($name);\r
+                                       return;\r
+                               } \r
+                               \r
+                               if ($name == $file) {\r
+                                       echo "<p class='error'>Error: Could not rename the directory &laquo;" . htmlspecialchars($file) . "&raquo; ";\r
+                                       echo "because the supplied name is the same as the original name. Please use a different name.</p>";\r
+                                       _skinfiles_rendir($name);\r
+                                       return;\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
+                               if (file_exists($directory . $name)) {\r
+                                       echo "<p class='error'>Error: Could not rename the directory &laquo;" . htmlspecialchars($file) . "&raquo; ";\r
+                                       echo "because the supplied name is already used by another file or directory. Consider using a different name, or ";\r
+                                       echo "delete the existing file or directory first</p>";\r
+                                       _skinfiles_rendir($name);\r
+                                       return;\r
+                               }\r
+                               \r
+                               if (!@rename($directory . $file, $directory . $name)) \r
+                               {\r
+                                       echo "<p class='error'>Error: Could not rename the directory &laquo;" . htmlspecialchars($file) . "&raquo;</p>";\r
+                                       _skinfiles_rendir($name);\r
+                                       return;\r
                                }\r
-                               exec("rsync -Wtr --delete ".$DIR_SKINS.$latestskins.$skin."/* ".$memberskin.'/');\r
-                               $msg .= "  $skin";\r
+       \r
+                               echo "<p class='message'>Message: The directory &laquo;" . htmlspecialchars($file) . "&raquo; has been renamed ";\r
+                               echo "to &laquo;" . htmlspecialchars($name) . "&raquo;</p>";\r
+                               sfShowDirectory($directory);\r
+                       }               \r
+                       else\r
+                       {\r
+                               echo "<p class='error'>Error: The directory &laquo;" . htmlspecialchars($file) . "&raquo;  does not exist ";\r
+                               echo "or you do not have permission to rename the directory</p>";\r
                        }\r
-               } else {\r
-                       showdir("No default skin folders found.  No action taken.");\r
-                       return;\r
                }\r
-               showdir($msg);\r
+               else\r
+               {\r
+                       // User cancelled\r
+                       sfShowDirectory($directory);\r
+               }\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
+       /* Create directory **************************************************************************************************************/\r
+\r
+       function _skinfiles_createdir() {\r
+       \r
+               $directory = trim(requestVar('dir'));\r
+               $directory = sfExpandDirectory($directory);\r
+\r
+               if (sfValidPath($directory) && is_dir($directory) && is_writable($directory)) \r
+               {\r
+                       $name = requestVar('name');\r
+                       \r
+                       if ($name == '') {\r
+                               echo "<p class='error'>Error: Could not create a new directory because there was no name supplied</p>";\r
+                               sfShowDirectory($directory);\r
+                               return;\r
+                       }\r
+                       \r
+                       if (sfIllegalFilename($name)) {\r
+                               echo "<p class='error'>Error: Could not create the directory &laquo;" . htmlspecialchars($name) . "&raquo; ";\r
+                               echo "because the supplied name contains one or more illegal characters</p>";\r
+                               sfShowDirectory($directory);\r
+                               return;\r
+                       } \r
+                       \r
+                       if (file_exists($directory . $name)) {\r
+                               echo "<p class='error'>Error: Could not create the directory &laquo;" . htmlspecialchars($name) . "&raquo; ";\r
+                               echo "because the supplied name is already used by another file or directory. Consider using a different name, or ";\r
+                               echo "delete the existing file or directory first</p>";\r
+                               sfShowDirectory($directory);\r
+                               return;\r
+                       }\r
+                       \r
+                       $mask = @umask(0000);\r
+\r
+                       if (!@mkdir($directory . $name, 0755)) \r
+                       {\r
+                               echo "<p class='error'>Error: Could not create the directory &laquo;" . htmlspecialchars($name) . "&raquo;</p>";\r
+                               sfShowDirectory($directory);\r
+                               return;\r
+                       }\r
+\r
+                       @umask($mask);\r
+                       \r
+                       echo "<p class='message'>Message: The directory &laquo;" . htmlspecialchars($name) . "&raquo; has been created</p>";\r
+                       sfShowDirectory($directory);\r
+               }               \r
+               else\r
+               {\r
+                       echo "<p class='error'>Error: The directory &laquo;" . htmlspecialchars(basename($directory)) . "&raquo;  does not exist ";\r
+                       echo "or you do not have permission to access that directory</p>";\r
+               }\r
        }\r
+       \r
+       \r
+       \r
+\r
+       /* Delete directory **************************************************************************************************************/\r
+\r
+       function _skinfiles_deldir() {\r
+\r
+               global $pluginUrl, $manager;\r
+               \r
+               $file      = trim(basename(requestVar('dir')));\r
+               $directory = trim(dirname(requestVar('dir')));\r
+               $directory = sfExpandDirectory ($directory);\r
+               \r
+               if (sfValidPath($directory . $file) && file_exists($directory . $file) && \r
+                       is_dir($directory . $file) && is_writable($directory . $file) &&\r
+                       sfDirectoryIsEmpty($directory . $file)) \r
+               {\r
+                       $relative = sfRelativePath ($directory);\r
+                       $delUrl  = $manager->addTicketToUrl($pluginUrl . '?action=deldir&dir=' . rawurlencode($relative . $file));\r
+\r
+                       echo '<p class="location">Current location: ' . sfDisplayPath($relative);\r
+                       echo '<a href="' . htmlspecialchars($delUrl) . '" title="Delete &laquo;' . $file . '&raquo;">';\r
+                       echo '<img src="' . $pluginUrl . 'dir.gif' . '" alt="" /> ' . $file . '</a></p>';\r
+\r
+                       echo '<div class="dialogbox">';\r
+                       echo '<form method="post" action="' . htmlspecialchars($pluginUrl) . '">';\r
+                       $manager->addTicketHidden();\r
+                       echo '<input type="hidden" name="action" value="deldir_process" />';\r
+                       echo '<input type="hidden" name="dir" value="' . htmlspecialchars($relative . $file) . '" />';\r
+\r
+                       echo '<h4>Delete directory &laquo;' . htmlspecialchars($file) . '&raquo;?</h4><div>';\r
+                       echo '<p class="buttons"><button name="sure" value="yes">Delete</button>';\r
+                       echo '<button name="sure" value="no">Cancel</button></p>';\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
+                       echo '</div></form></div>';\r
                }\r
+               else\r
+               {\r
+                       echo "<p class='error'>Error: The directory  &laquo;" . htmlspecialchars($file) . "&raquo;  does not exist ";\r
+                       echo "or you do not have permission to delete the directory</p>";\r
+               }\r
+       }\r
+       \r
+       function _skinfiles_deldir_process() {\r
+\r
+               global $pluginUrl, $manager;\r
+               \r
+               $file      = trim(basename(requestVar('dir')));\r
+               $directory = trim(dirname(requestVar('dir')));\r
+               $directory = sfExpandDirectory ($directory);\r
+               \r
+               if (requestVar('sure') == 'yes')\r
+               {\r
+                       if (sfValidPath($directory . $file) && file_exists($directory . $file) && \r
+                               is_dir($directory . $file) && is_writable($directory . $file) &&\r
+                               sfDirectoryIsEmpty($directory . $file)) \r
+                       {\r
+                               if (!@rmdir($directory . $file)) \r
+                               {\r
+                                       echo "<p class='error'>Error: Could not delete the directory &laquo;" . htmlspecialchars($file) . "&raquo;</p>";\r
+                                       sfShowDirectory($directory);\r
+                                       return;\r
+                               }\r
        \r
-               if ($privateskins && (!is_dir($DIR_SKINS.$SKINSUBDIR))) {\r
-                       $oldumask = umask(0);\r
-                       mkdir($DIR_SKINS.$SKINSUBDIR, 0755);\r
-                       umask($oldmask);\r
+                               echo "<p class='message'>Message: The directory &laquo;" . htmlspecialchars($file) . "&raquo; has been deleted</p>";\r
+                               sfShowDirectory($directory);\r
+                       }               \r
+                       else\r
+                       {\r
+                               echo "<p class='error'>Error: The directory &laquo;" . htmlspecialchars($file) . "&raquo;  does not exist ";\r
+                               echo "or you do not have permission to delete the directory</p>";\r
+                       }\r
+               }\r
+               else\r
+               {\r
+                       // User cancelled\r
+                       sfShowDirectory($directory);\r
                }\r
+       }       \r
+       \r
+       \r
+       \r
+       \r
+       /* Empty directory ***************************************************************************************************************/\r
+\r
+       function _skinfiles_emptydir() {\r
+\r
+               global $pluginUrl, $manager;\r
+               \r
+               $file      = trim(basename(requestVar('dir')));\r
+               $directory = trim(dirname(requestVar('dir')));\r
+               $directory = sfExpandDirectory ($directory);\r
+               \r
+               if (sfValidPath($directory . $file) && file_exists($directory . $file) && is_dir($directory . $file)) \r
+               {\r
+                       $files = array();\r
+       \r
+                       if ($dh = @opendir($directory . $file)) \r
+                       { \r
+                               while (($name = readdir($dh)) !== false) {\r
+                                       if(!preg_match("/^\.{1,2}$/", $name) && \r
+                                          !is_dir($directory . $file . '/' . $name) &&\r
+                                          is_writable($directory . $file . '/' . $name)) \r
+                                                       $files[] = $name;\r
+                               }\r
+                               \r
+                               closedir($dh); \r
+                               sort($files);\r
+                       }\r
+                       \r
+                       $relative = sfRelativePath ($directory);\r
+                       $emptyUrl  = $manager->addTicketToUrl($pluginUrl . '?action=emptydir&dir=' . rawurlencode($relative . $file));\r
+\r
+                       echo '<p class="location">Current location: ' . sfDisplayPath($relative);\r
+                       echo '<a href="' . htmlspecialchars($emptyUrl) . '" title="Empty &laquo;' . $file . '&raquo;">';\r
+                       echo '<img src="' . $pluginUrl . 'dir.gif' . '" alt="" /> ' . $file . '</a></p>';\r
 \r
-               if (!is_dir($currdir)) {\r
-                       echo 'The specified location is not a directory or doesn\'t exist.';\r
-                       return;\r
+                       echo '<div class="dialogbox">';\r
+                       echo '<form method="post" action="' . htmlspecialchars($pluginUrl) . '">';\r
+                       $manager->addTicketHidden();\r
+                       echo '<input type="hidden" name="action" value="emptydir_process" />';\r
+                       echo '<input type="hidden" name="dir" value="' . htmlspecialchars($relative . $file) . '" />';\r
+\r
+                       echo '<h4>Delete the following files from directory &laquo;' . htmlspecialchars($file) . '&raquo;?</h4><div>';\r
+                       \r
+                       if (count($files)) \r
+                       {\r
+                               echo '<ul>';\r
+                               foreach ($files as $name) {     echo '<li>' . htmlspecialchars($name) . '</li>'; }\r
+                               echo '</ul>';\r
+       \r
+                               echo '<p class="buttons"><button name="sure" value="yes">Delete</button>';\r
+                               echo '<button name="sure" value="no">Cancel</button></p>';\r
+                       }\r
+                       else\r
+                       {\r
+                               echo '<p>There are currently no files in this directory that can be deleted</p>';\r
+                               echo '<p class="buttons"><button name="sure" value="no">Cancel</button></p>';\r
+                       }\r
+                       \r
+                       echo '</div></form></div>';\r
+                       \r
                }\r
+               else\r
+               {\r
+                       echo "<p class='error'>Error: The directory &laquo;" . htmlspecialchars($file) . "&raquo;  does not exist ";\r
+                       echo "or you do not have permission to access that directory</p>";\r
+               }\r
+       }\r
+\r
+       function _skinfiles_emptydir_process() {\r
+\r
+               global $pluginUrl, $manager;\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
+               $file      = trim(basename(requestVar('dir')));\r
+               $directory = trim(dirname(requestVar('dir')));\r
+               $directory = sfExpandDirectory ($directory);\r
+               \r
+               if (requestVar('sure') == 'yes')\r
+               {\r
+                       if (sfValidPath($directory . $file) && file_exists($directory . $file) && is_dir($directory . $file)) \r
+                       {\r
+                               if ($dh = @opendir($directory . $file)) \r
+                               { \r
+                                       while (($name = readdir($dh)) !== false) \r
+                                       {\r
+                                               if(!preg_match("/^\.{1,2}$/", $name) &&  !is_dir($directory . $file . '/' . $name) &&\r
+                                                  is_writable($directory . $file . '/' . $name)) \r
+                                               {\r
+                                                       if (unlink ($directory .$file . '/' . $name)) \r
+                                                               echo "<p class='message'>Message: The file &laquo;" . htmlspecialchars($name) . "&raquo; has been deleted</p>";\r
+                                                       else\r
+                                                               echo "<p class='error'>Error: The file &laquo;" . htmlspecialchars($name) . "&raquo; could not be deleted</p>";\r
+                                               }\r
                                        }\r
+                                       \r
+                                       closedir($dh); \r
+       \r
+                                       sfShowDirectory($directory . $file . '/');\r
                                }\r
                        }\r
-                       closedir($dh); \r
-               } \r
+                       else\r
+                       {\r
+                               echo "<p class='error'>Error: The directory &laquo;" . htmlspecialchars($file) . "&raquo;  does not exist ";\r
+                               echo "or you do not have permission to access that directory</p>";\r
+                       }\r
+               }\r
+               else\r
+               {\r
+                       // User cancelled\r
+                       sfShowDirectory($directory . $file . '/');\r
+               }\r
+       }\r
+\r
+\r
+\r
+\r
+       /* Download file *****************************************************************************************************************/\r
+\r
+       function _skinfiles_download() {\r
+\r
+               global $pluginUrl, $manager;\r
+               \r
+               $file = basename(trim(requestVar('file')));\r
+\r
+               $directory = dirname(trim(requestVar('file')));\r
+               $directory = sfExpandDirectory ($directory);\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
+               if (sfValidPath($directory) && file_exists($directory . $file) && \r
+                       is_file($directory . $file) && is_readable($directory . $file)) \r
+               {\r
+                       if (strstr(serverVar('HTTP_USER_AGENT'), "MSIE"))\r
+                               $name = preg_replace('/\./', '%2e', $file, substr_count($file, '.') - 1);\r
+                       else\r
+                               $name = $file;\r
+                               \r
+                       if ($fp = @fopen($directory . $file, 'r')) {\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="'.$name.'"');\r
+                               header("Content-length: ".(string)(filesize($directory . $file)));\r
+                               sleep(1);\r
+                               \r
+                               fpassthru($fp);\r
+                               fclose($fp);\r
+                       }\r
+                       else\r
+                       {\r
+                               echo "Error: Could not access the file";\r
+                       }\r
+               }\r
+               else\r
+               {\r
+                       echo "Error: No permission to access the file";\r
+               }\r
+\r
+               exit;\r
+       }\r
+\r
+\r
+\r
+\r
+       /* View file *********************************************************************************************************************/\r
+\r
+       function _skinfiles_viewfile() {\r
+\r
+               global $pluginUrl, $manager;\r
+               \r
+               $file      = basename(trim(requestVar('file')));\r
+               $directory = dirname(trim(requestVar('file')));\r
+               $directory = sfExpandDirectory ($directory);\r
+               \r
+               if (sfValidPath($directory) && file_exists($directory . $file) && \r
+                       is_file($directory . $file) && is_readable($directory . $file) && sfAllowViewing($file)) \r
+               {\r
+                       $relative = sfRelativePath ($directory);\r
+                       $viewUrl  = $manager->addTicketToUrl($pluginUrl . '?action=viewfile&file=' . rawurlencode(sfRelativePath($directory . $file)));\r
+\r
+                       echo '<p class="location">Current location: ' . sfDisplayPath($relative);\r
+                       echo '<a href="' . htmlspecialchars($viewUrl) . '" title="View &laquo;' . $file . '&raquo;">';\r
+                       echo '<img src="' . htmlspecialchars(sfIcon($file)) . '" alt="" /> ' . $file . '</a></p>';\r
+\r
+                       echo '<h4>View file &laquo;' . htmlspecialchars($file) . '&raquo;</h4>';\r
+\r
+                       if (sfIsFileType('html', $file))\r
+                       {\r
+                               echo '<iframe src="' . sfFullUrl($directory . $file) . '"></iframe>';\r
+                       }\r
+\r
+                       if (sfIsFileType('text', $file))\r
+                       {\r
+                               $content = implode('', file($directory . $file));\r
+\r
+                               echo '<pre>';\r
+                               echo htmlspecialchars($content);\r
+                               echo '</pre>';\r
+                       }\r
+\r
+                       if (sfIsFileType('img', $file))\r
+                       {\r
+                               $size = getimagesize($directory . $file, $info);\r
+                               \r
+                               switch ($size[2]) {\r
+                                       case IMAGETYPE_GIF:             $type = 'GIF document'; break;\r
+                                       case IMAGETYPE_JPEG:    $type = 'JPEG photograph'; break;\r
+                                       case IMAGETYPE_PNG:             $type = 'PNG document'; break;\r
+                                       case IMAGETYPE_SWF:             $type = 'Flash animation'; break;\r
+                                       case IMAGETYPE_PSD:             $type = 'Photoshop document'; break;\r
+                                       case IMAGETYPE_BMP:             $type = 'BMP document'; break;\r
+                                       case IMAGETYPE_TIFF_II: $type = 'TIFF document (Intel Byte Order)'; break;\r
+                                       case IMAGETYPE_TIFF_MM: $type = 'TIFF document (Motorola Byte Order)'; break;\r
+                                       case IMAGETYPE_JPC:             $type = 'JPEG2000 photograph'; break;\r
+                                       case IMAGETYPE_JP2:     $type = 'JPEG2000 photograph'; break;\r
+                                       case IMAGETYPE_JPX:     $type = 'JPEG2000 photograph'; break;\r
+                                       case IMAGETYPE_JB2:     $type = 'Slowview document'; break;\r
+                                       case IMAGETYPE_SWC:     $type = 'Flash animation (compressed)'; break;\r
+                                       case IMAGETYPE_IFF:     $type = 'IFF document'; break;\r
+                                       case IMAGETYPE_WBMP:    $type = 'WBMP document'; break;\r
+                                       case IMAGETYPE_XBM:     $type = 'XBM document'; break;\r
+                                       default:                                $type = 'Unknown document'; break;\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
+                               if ($size[2] == IMAGETYPE_GIF || $size[2] == IMAGETYPE_JPEG ||\r
+                                       $size[2] == IMAGETYPE_PNG)\r
+                               {\r
+                                       echo '<p><img src="' . sfFullUrl($directory . $file) . '" alt="" /></p>';\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 '<table>';\r
+                               echo '<tr><th colspan="2">Image information</th></tr>';\r
+                               echo '<tr><td>Type:</td><td>' . htmlspecialchars($type) . '</td></tr>';\r
+                               echo '<tr><td>Width:</td><td>' . htmlspecialchars($size[0]) . ' px</td></tr>';\r
+                               echo '<tr><td>Height:</td><td>' . htmlspecialchars($size[1]) . ' px</td></tr>'; \r
+                               \r
+                               if (isset($size['channels']) || isset($size['bits'])) \r
+                               {\r
+                                       $channels = isset($size['channels']) ? $size['channels'] : 3;\r
+                                       $depth    = $size[2] == IMAGETYPE_GIF ? $size['bits'] : $size['bits'] * $channels;\r
+                                       echo '<tr><td>Channels:</td><td>' . htmlspecialchars($channels) . '</td></tr>';\r
+                                       echo '<tr><td>Color depth:</td><td>' . htmlspecialchars($depth) . ' bits</td></tr>';\r
+                                       echo '<tr><td>Colors:</td><td>' . htmlspecialchars(pow(2, $depth)) . ' colors</td></tr>';\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
+                               if (function_exists('exif_read_data') && ($size[2] == IMAGETYPE_JPEG || \r
+                                       $size[2] == IMAGETYPE_TIFF_II || $size[2] == IMAGETYPE_TIFF_MM))\r
+                               {\r
+                                       $exif = exif_read_data($directory . $file, 'EXIF');\r
+                                       \r
+                                       if ($exif) \r
+                                       {\r
+                                               echo '<tr><th colspan="2">Exif information</th></tr>';\r
+                                               \r
+                                               if (isset($exif['Make']) && isset($exif['Model']))\r
+                                                       echo '<tr><td>Camera:</td><td>' . htmlspecialchars($exif['Make'] . ' ' . $exif['Model']) . '</td></tr>';\r
+                                               \r
+                                               if (isset($exif['DateTime']))\r
+                                                       echo '<tr><td>Created on:</td><td>' . htmlspecialchars($exif['DateTime']) . '</td></tr>';\r
+                                               \r
+                                               if (isset($exif['XResolution']))\r
+                                                       echo '<tr><td>Horizontal resolution:</td><td>' . htmlspecialchars(_skinfiles_exif_prepare($exif['XResolution'])) . ' dpi</td></tr>';\r
+                                               \r
+                                               if (isset($exif['YResolution']))\r
+                                                       echo '<tr><td>Vertical resolution:</td><td>' . htmlspecialchars(_skinfiles_exif_prepare($exif['YResolution'])) . ' dpi</td></tr>';\r
+                                               \r
+                                               if (isset($exif['FocalLength']))\r
+                                                       echo '<tr><td>Focal length:</td><td>' . htmlspecialchars(_skinfiles_exif_prepare($exif['FocalLength'])) . ' mm</td></tr>';\r
+                                               \r
+                                               if (isset($exif['FNumber']))\r
+                                                       echo '<tr><td>F-number:</td><td>F/' . htmlspecialchars(_skinfiles_exif_prepare($exif['FNumber'])) . '</td></tr>';\r
+                                               \r
+                                               if (isset($exif['ExposureTime']))\r
+                                                       echo '<tr><td>Exposuretime:</td><td>' . htmlspecialchars(_skinfiles_exif_prepare($exif['ExposureTime'])) . ' sec</td></tr>';\r
+                                               \r
+                                               if (isset($exif['ISOSpeedRatings']))\r
+                                                       echo '<tr><td>ISO-speed:</td><td>' . htmlspecialchars(_skinfiles_exif_prepare($exif['ISOSpeedRatings'])) . '</td></tr>';\r
+                                       }\r
                                }\r
+\r
+                               echo '</table>';\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
+               else\r
+               {\r
+                       echo "<p class='error'>Error: The file &laquo;" . htmlspecialchars($file) . "&raquo;  does not exist ";\r
+                       echo "or you do not have permission to view the file</p>";\r
+               }\r
+       }\r
+\r
+       function _skinfiles_exif_prepare($value) {\r
+               if (preg_match('#([0-9]+)/([0-9]+)#', $value, $matches))\r
+                       if ($matches[1] < $matches[2])\r
+                               return '1/' . round($matches[2] / $matches[1]);\r
+                       else\r
+                               return round($matches[1] / $matches[2]);\r
+               else\r
+                       return $value;\r
+       }\r
+\r
+\r
+\r
+\r
+       /* Edit file *********************************************************************************************************************/\r
+\r
+       function _skinfiles_editfile() {\r
+\r
+               global $pluginUrl, $manager;\r
+               \r
+               $file      = basename(trim(requestVar('file')));\r
+               $directory = dirname(trim(requestVar('file')));\r
+               $directory = sfExpandDirectory ($directory);\r
+               \r
+               if (sfValidPath($directory) && file_exists($directory . $file) && \r
+                       is_file($directory . $file) && is_writable($directory . $file) && sfAllowEditing($file)) \r
+               {\r
+                       $relative = sfRelativePath ($directory);\r
+                       $editUrl  = $manager->addTicketToUrl($pluginUrl . '?action=editfile&file=' . rawurlencode(sfRelativePath($directory . $file)));\r
+\r
+                       echo '<p class="location">Current location: ' . sfDisplayPath($relative);\r
+                       echo '<a href="' . htmlspecialchars($editUrl) . '" title="Edit &laquo;' . $file . '&raquo;">';\r
+                       echo '<img src="' . htmlspecialchars(sfIcon($file)) . '" alt="" /> ' . $file . '</a></p>';\r
+\r
+                       $content = implode('', file($directory . $file));\r
+\r
+                       echo '<div class="dialogbox">';\r
+                       echo '<form method="post" action="' . htmlspecialchars($pluginUrl) . '">';\r
+                       $manager->addTicketHidden();\r
+                       echo '<input type="hidden" name="action" value="editfile_process" />';\r
+                       echo '<input type="hidden" name="file" value="' . htmlspecialchars(sfRelativePath($directory . $file)) . '" />';\r
+\r
+                       echo '<h4>Edit file &laquo;' . htmlspecialchars($file) . '&raquo;</h4><div>';\r
+                       echo '<p><textarea class="skinedit" tabindex="8" rows="20" cols="80" name="content">';\r
+                       echo htmlspecialchars($content);\r
+                       echo '</textarea></p>';\r
+                       \r
+                       echo '<p class="buttons"><button name="sure" value="yes" onclick="return checkSubmit();">Save Changes</button>';\r
+                       echo '<button name="sure" value="no">Cancel</button></p></div>';\r
+                       echo '</form>';\r
+                       echo '</div>';\r
+               }\r
+               else\r
+               {\r
+                       echo "<p class='error'>Error: The file &laquo;" . htmlspecialchars($file) . "&raquo;  does not exist ";\r
+                       echo "or you do not have permission to edit the file</p>";\r
+               }\r
+       }\r
+\r
+       function _skinfiles_editfile_process() {\r
+\r
+               $file      = basename(trim(requestVar('file')));\r
+               $directory = dirname(trim(requestVar('file')));\r
+               $directory = sfExpandDirectory ($directory);\r
+               \r
+               if (requestVar('sure') == 'yes')\r
+               {\r
+                       if (sfValidPath($directory) && file_exists($directory . $file) && \r
+                               is_file($directory . $file) && is_writable($directory . $file) && sfAllowEditing($file)) \r
+                       {\r
+                               $content = postVar('content');\r
+                               $success = false;\r
+                               \r
+                               if ($fh = @fopen($directory . $file, 'wb')) { \r
+                                       \r
+                                       if (@fwrite($fh, $content) !== false)\r
+                                               $success = true;\r
+                                               \r
+                                       @fclose($fh);\r
+                               }\r
+                               \r
+                               if ($success)\r
+                                       echo "<p class='message'>Message: The file &laquo;" . htmlspecialchars($file) . "&raquo; has been saved</p>";\r
+                               else\r
+                                       echo "<p class='error'>Error: The file &laquo;" . htmlspecialchars($file) . "&raquo; could not be saved</p>";\r
+                       \r
+                               _skinfiles_editfile();\r
+                       }\r
+                       else\r
+                       {\r
+                               echo "<p class='error'>Error: The file &laquo;" . htmlspecialchars($file) . "&raquo;  does not exist ";\r
+                               echo "or you do not have permission to edit the file</p>";\r
+                       }\r
+               }\r
+               else\r
+               {\r
+                       // User cancelled\r
+                       sfShowDirectory($directory);\r
+               }\r
+       }\r
+\r
+\r
+\r
+       /* Rename file *******************************************************************************************************************/\r
+\r
+       function _skinfiles_renfile($preset = '') {\r
+\r
+               global $pluginUrl, $manager;\r
+               \r
+               $file      = basename(trim(requestVar('file')));\r
+               $directory = dirname(trim(requestVar('file')));\r
+               $directory = sfExpandDirectory ($directory);\r
+               \r
+               if (sfValidPath($directory) && file_exists($directory . $file) && \r
+                       is_file($directory . $file) && is_writable($directory . $file)) \r
+               {\r
+                       $relative = sfRelativePath ($directory);\r
+                       $editUrl  = $manager->addTicketToUrl($pluginUrl . '?action=renfile&file=' . rawurlencode(sfRelativePath($directory . $file)));\r
+\r
+                       echo '<p class="location">Current location: ' . sfDisplayPath($relative);\r
+                       echo '<a href="' . htmlspecialchars($editUrl) . '" title="Rename &laquo;' . $file . '&raquo;">';\r
+                       echo '<img src="' . htmlspecialchars(sfIcon($file)) . '" alt="" /> ' . $file . '</a></p>';\r
+\r
+                       echo '<div class="dialogbox">';\r
+                       echo '<form method="post" action="' . htmlspecialchars($pluginUrl) . '">';\r
+                       $manager->addTicketHidden();\r
+                       echo '<input type="hidden" name="action" value="renfile_process" />';\r
+                       echo '<input type="hidden" name="file" value="' . htmlspecialchars(sfRelativePath($directory . $file)) . '" />';\r
+\r
+                       echo '<h4>Rename file &laquo;' . htmlspecialchars($file) . '&raquo; to:</h4><div>';\r
+                       echo '<p><input type="text" name="name" size="40" value="' . htmlspecialchars($preset != '' ? $preset : $file) . '" /></p>';\r
+                       echo '<p class="buttons"><button name="sure" value="yes" onclick="return checkSubmit();">Rename</button>';\r
+                       echo '<button name="sure" value="no">Cancel</button></p></div>';\r
+                       echo '</form>';\r
+                       echo '</div>';\r
+               }\r
+               else\r
+               {\r
+                       echo "<p class='error'>Error: The file &laquo;" . htmlspecialchars($file) . "&raquo;  does not exist ";\r
+                       echo "or you do not have permission to rename the file</p>";\r
+               }\r
+       }\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
+       function _skinfiles_renfile_process() {\r
+\r
+               global $pluginUrl, $manager;\r
+               \r
+               $file      = basename(trim(requestVar('file')));\r
+               $directory = dirname(trim(requestVar('file')));\r
+               $directory = sfExpandDirectory ($directory);\r
+               \r
+               if (requestVar('sure') == 'yes')\r
+               {\r
+                       if (sfValidPath($directory) && file_exists($directory . $file) && \r
+                               is_file($directory . $file) && is_writable($directory . $file)) \r
+                       {\r
+                               $name = requestVar('name');\r
+                               \r
+                               if ($name == '') {\r
+                                       echo "<p class='error'>Error: Could not rename the file &laquo;" . htmlspecialchars($file) . "&raquo; ";\r
+                                       echo "because no new name was supplied.</p>";\r
+                                       _skinfiles_renfile($name);\r
+                                       return;\r
                                }\r
-                               closedir($dh); \r
+                               \r
+                               if (sfIllegalFilename($name)) {\r
+                                       echo "<p class='error'>Error: Could not rename the file &laquo;" . htmlspecialchars($file) . "&raquo; ";\r
+                                       echo "because the supplied file name contains one or more illegal characters</p>";\r
+                                       _skinfiles_renfile($name);\r
+                                       return;\r
+                               } \r
+                               \r
+                               if ($name == $file) {\r
+                                       echo "<p class='error'>Error: Could not rename the file &laquo;" . htmlspecialchars($file) . "&raquo; ";\r
+                                       echo "because the supplied name is the same as the original name. Please use a different name.</p>";\r
+                                       _skinfiles_renfile($name);\r
+                                       return;\r
+                               }\r
+                               \r
+                               if (file_exists($directory . $name)) {\r
+                                       echo "<p class='error'>Error: Could not rename the file &laquo;" . htmlspecialchars($file) . "&raquo; ";\r
+                                       echo "because the supplied name is already used by another file or directory. Consider using a different name, or ";\r
+                                       echo "delete the existing file or directory first</p>";\r
+                                       _skinfiles_renfile($name);\r
+                                       return;\r
+                               }\r
+                               \r
+                               if (!@rename($directory . $file, $directory . $name)) \r
+                               {\r
+                                       echo "<p class='error'>Error: Could not rename the file &laquo;" . htmlspecialchars($file) . "&raquo;</p>";\r
+                                       _skinfiles_renfile($name);\r
+                                       return;\r
+                               }\r
+       \r
+                               echo "<p class='message'>Message: The file &laquo;" . htmlspecialchars($file) . "&raquo; has been renamed ";\r
+                               echo "to &laquo;" . htmlspecialchars($name) . "&raquo;</p>";\r
+                               sfShowDirectory($directory);\r
+                       }               \r
+                       else\r
+                       {\r
+                               echo "<p class='error'>Error: The file &laquo;" . htmlspecialchars($file) . "&raquo;  does not exist ";\r
+                               echo "or you do not have permission to rename the file</p>";\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
+               else\r
+               {\r
+                       // User cancelled\r
+                       sfShowDirectory($directory);\r
+               }\r
+       }\r
+\r
+\r
+\r
+\r
+       /* Create file *******************************************************************************************************************/\r
+\r
+       function _skinfiles_createfile() {\r
+       \r
+               $directory = trim(requestVar('dir'));\r
+               $directory = sfExpandDirectory($directory);\r
+\r
+               if (sfValidPath($directory) && is_dir($directory) && is_writable($directory)) \r
+               {\r
+                       $name = requestVar('name');\r
+                       \r
+                       if ($name == '') {\r
+                               echo "<p class='error'>Error: Could not create a new file because there was no name supplied</p>";\r
+                               sfShowDirectory($directory);\r
+                               return;\r
                        }\r
+                       \r
+                       if (sfIllegalFilename($name)) {\r
+                               echo "<p class='error'>Error: Could not create the file &laquo;" . htmlspecialchars($name) . "&raquo; ";\r
+                               echo "because the supplied file name contains one or more illegal characters</p>";\r
+                               sfShowDirectory($directory);\r
+                               return;\r
+                       } \r
+                       \r
+                       if (file_exists($directory . $name)) {\r
+                               echo "<p class='error'>Error: Could not create the file &laquo;" . htmlspecialchars($name) . "&raquo; ";\r
+                               echo "because the supplied name is already used by another file or directory. Consider using a different name, or ";\r
+                               echo "delete the existing file or directory first</p>";\r
+                               sfShowDirectory($directory);\r
+                               return;\r
+                       }\r
+                       \r
+                       if (!@touch($directory . $name)) \r
+                       {\r
+                               echo "<p class='error'>Error: Could not create the file &laquo;" . htmlspecialchars($name) . "&raquo;</p>";\r
+                               sfShowDirectory($directory);\r
+                               return;\r
+                       }\r
+\r
+                       $mask = @umask(0000);\r
+                       @chmod($directory . $name, 0755);\r
+                       @umask($mask);\r
+                       \r
+                       echo "<p class='message'>Message: The file &laquo;" . htmlspecialchars($name) . "&raquo; has been created</p>";\r
+                       sfShowDirectory($directory);\r
+               }               \r
+               else\r
+               {\r
+                       echo "<p class='error'>Error: The directory &laquo;" . htmlspecialchars(basename($directory)) . "&raquo;  does not exist ";\r
+                       echo "or you do not have permission to access that directory</p>";\r
                }\r
+       }\r
+\r
+\r
+\r
+\r
+       /* Delete file *******************************************************************************************************************/\r
+\r
+       function _skinfiles_delfile() {\r
+\r
+               global $pluginUrl, $manager;\r
+               \r
+               $file      = basename(trim(requestVar('file')));\r
+               $directory = dirname(trim(requestVar('file')));\r
+               $directory = sfExpandDirectory ($directory);\r
+               \r
+               if (sfValidPath($directory) && file_exists($directory . $file) && \r
+                       is_file($directory . $file) && is_writable($directory . $file)) \r
+               {\r
+                       $relative = sfRelativePath ($directory);\r
+                       $delUrl  = $manager->addTicketToUrl($pluginUrl . '?action=delfile&file=' . rawurlencode(sfRelativePath($directory . $file)));\r
+\r
+                       echo '<p class="location">Current location: ' . sfDisplayPath($relative);\r
+                       echo '<a href="' . htmlspecialchars($delUrl) . '" title="Delete &laquo;' . $file . '&raquo;">';\r
+                       echo '<img src="' . htmlspecialchars(sfIcon($file)) . '" alt="" /> ' . $file . '</a></p>';\r
+\r
+                       echo '<div class="dialogbox">';\r
+                       echo '<form method="post" action="' . htmlspecialchars($pluginUrl) . '">';\r
+                       $manager->addTicketHidden();\r
+                       echo '<input type="hidden" name="action" value="delfile_process" />';\r
+                       echo '<input type="hidden" name="file" value="' . htmlspecialchars(sfRelativePath($directory . $file)) . '" />';\r
+\r
+                       echo '<h4>Delete file &laquo;' . htmlspecialchars($file) . '&raquo;?</h4><div>';\r
+                       echo '<p class="buttons"><button name="sure" value="yes">Delete</button>';\r
+                       echo '<button name="sure" value="no">Cancel</button></p>';\r
 \r
+                       echo '</div></form></div>';\r
+               }\r
+               else\r
+               {\r
+                       echo "<p class='error'>Error: The file &laquo;" . htmlspecialchars($file) . "&raquo;  does not exist ";\r
+                       echo "or you do not have permission to delete the file</p>";\r
+               }\r
        }\r
 \r
+       function _skinfiles_delfile_process() {\r
+\r
+               global $pluginUrl, $manager;\r
+               \r
+               $file      = basename(trim(requestVar('file')));\r
+               $directory = dirname(trim(requestVar('file')));\r
+               $directory = sfExpandDirectory ($directory);\r
+               \r
+               if (requestVar('sure') == 'yes')\r
+               {\r
+                       if (sfValidPath($directory) && file_exists($directory . $file) && \r
+                               is_file($directory . $file) && is_writable($directory . $file)) \r
+                       {\r
+                               if (!@unlink($directory . $file)) \r
+                               {\r
+                                       echo "<p class='error'>Error: Could not delete the file &laquo;" . htmlspecialchars($file) . "&raquo;</p>";\r
+                                       sfShowDirectory($directory);\r
+                                       return;\r
+                               }\r
        \r
+                               echo "<p class='message'>Message: The file &laquo;" . htmlspecialchars($file) . "&raquo; has been deleted</p>";\r
+                               sfShowDirectory($directory);\r
+                       }               \r
+                       else\r
+                       {\r
+                               echo "<p class='error'>Error: The file &laquo;" . htmlspecialchars($file) . "&raquo;  does not exist ";\r
+                               echo "or you do not have permission to delete the file</p>";\r
+                       }\r
+               }\r
+               else\r
+               {\r
+                       // User cancelled\r
+                       sfShowDirectory($directory);\r
+               }\r
+       }\r
+\r
+\r
+\r
+       /* Upload file *******************************************************************************************************************/\r
+\r
+       function _skinfiles_uploadfile() {\r
+\r
+               global $pluginUrl, $manager, $CONF;\r
+               \r
+               $directory = trim(requestVar('dir'));\r
+               $directory = sfExpandDirectory($directory);\r
+\r
+               if (sfValidPath($directory) && is_dir($directory) && is_writable($directory)) \r
+               {\r
+                       $file = postFileInfo('name');\r
+\r
+                       if ($file['size'] > $CONF['MaxUploadSize']) {\r
+                               echo "<p class='error'>Error: Could not upload the file &laquo;" . htmlspecialchars($file['name']) . "&raquo;. " . $CONF['MaxUploadSize'] . '/' . $file['size'] . _ERROR_FILE_TOO_BIG . "</p>";\r
+                               sfShowDirectory($directory);\r
+                               return;\r
+                       }\r
+\r
+                       if (!is_uploaded_file($file['tmp_name'])) {\r
+                               echo "<p class='error'>Error: Could not upload the file &laquo;" . htmlspecialchars($file['name']) . "&raquo;. " . _ERROR_BADREQUEST . "</p>";\r
+                               sfShowDirectory($directory);\r
+                               return;\r
+                       }\r
+                       \r
+                       if (sfIllegalFilename($file['name'])) {\r
+                               echo "<p class='error'>Error: Could not upload the file &laquo;" . htmlspecialchars($file['name']) . "&raquo; ";\r
+                               echo "because the supplied file name contains one or more illegal characters</p>";\r
+                               sfShowDirectory($directory);\r
+                               return;\r
+                       }\r
+                       \r
+                       if (file_exists($directory . $file['name'])) {\r
+                               echo "<p class='error'>Error: Could not upload the file &laquo;" . htmlspecialchars($file['name']) . "&raquo;. " . _ERROR_UPLOADDUPLICATE . "</p>";\r
+                               sfShowDirectory($directory);\r
+                               return;\r
+                       }\r
+\r
+                       if (!@move_uploaded_file($file['tmp_name'], $directory . $file['name'])) {\r
+                               echo "<p class='error'>Error: Could not upload the file &laquo;" . htmlspecialchars($file['name']) . "&raquo;. " . _ERROR_UPLOADMOVE . "</p>";\r
+                               sfShowDirectory($directory);\r
+                       }\r
+\r
+                       $mask = @umask(0000);\r
+                       @chmod($directory . $file['name'], 0755);\r
+                       @umask($mask);\r
+\r
+                       echo "<p class='message'>Message: The file &laquo;" . htmlspecialchars($file['name']) . "&raquo; has been uploaded</p>";\r
+                       sfShowDirectory($directory);\r
+               }\r
+               else\r
+               {\r
+                       echo "<p class='error'>Error: The directory &laquo;" . htmlspecialchars(basename($directory)) . "&raquo;  does not exist ";\r
+                       echo "or you do not have permission to access that directory</p>";\r
+               }       \r
+       }\r
+\r
+\r
+\r
+\r
        \r
 ?>
\ No newline at end of file
index 7735fde..bfbacdf 100644 (file)
Binary files a/utf8/nucleus/plugins/skinfiles/php.gif and b/utf8/nucleus/plugins/skinfiles/php.gif differ
index 66ceefb..102cedd 100644 (file)
Binary files a/utf8/nucleus/plugins/skinfiles/text.gif and b/utf8/nucleus/plugins/skinfiles/text.gif differ
index 591fd15..87b4d4c 100755 (executable)
@@ -1,5 +1,5 @@
 <?php\r
-/*\r
+/*\r
   * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/) \r
   * Copyright (C) 2002-2005 The Nucleus Group\r
   *\r
@@ -8,15 +8,17 @@
   * 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
-  * $Id: api_blogger.inc.php,v 1.3 2005-03-12 06:19:06 kimitake Exp $\r
-  * $NucleusJP$\r
   */\r
   \r
-/*\r
+/**\r
  * This file contains definitions for the methods in the Blogger API\r
+ *\r
+ * @license http://nucleuscms.org/license.txt GNU General Public License\r
+ * @copyright Copyright (C) 2002-2005 The Nucleus Group\r
+ * @version $Id: api_blogger.inc.php,v 1.3.2.1 2005-08-25 07:04:14 kimitake Exp $\r
+ * @version $NucleusJP: api_blogger.inc.php,v 1.3 2005/03/12 06:19:06 kimitake Exp $\r
  */\r
-\r
+  \r
 \r
        // blogger.newPost\r
        $f_blogger_newPost_sig = array(array(\r
index 805cf56..5be4860 100755 (executable)
@@ -1,6 +1,6 @@
 <?php\r
 \r
-/*\r
+/*\r
   * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/) \r
   * Copyright (C) 2002-2005 The Nucleus Group\r
   *\r
@@ -9,13 +9,15 @@
   * 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
-  * $Id: api_metaweblog.inc.php,v 1.3 2005-03-12 06:19:06 kimitake Exp $\r
-  * $NucleusJP$\r
   */\r
 \r
-/*\r
+/**\r
  *     This file contains definitions for the methods of the metaWeblog API\r
+ *\r
+ * @license http://nucleuscms.org/license.txt GNU General Public License\r
+ * @copyright Copyright (C) 2002-2005 The Nucleus Group\r
+ * @version $Id: api_metaweblog.inc.php,v 1.3.2.1 2005-08-25 07:04:14 kimitake Exp $\r
+ * @version $NucleusJP: api_metaweblog.inc.php,v 1.3 2005/03/12 06:19:06 kimitake Exp $\r
  */\r
         \r
        \r
                ));\r
        $f_metaWeblog_newPost_doc = "Adds a new item to the given blog. Adds it as a draft when publish is false";\r
        function f_metaWeblog_newPost($m) {\r
+               global $manager;\r
+\r
                $blogid =                       _getScalar($m,0);\r
                $username =             _getScalar($m,1);\r
                $password =             _getScalar($m,2);\r
                $struct =                       $m->getParam(3);\r
+               \r
                        $content =              _getStructVal($struct, 'description');\r
+                       $more =                 _getStructVal($struct, 'mt_text_more');\r
                        $title =                _getStructVal($struct, 'title');\r
 \r
                        // category is optional (thus: be careful)!\r
                        if ($catlist && ($catlist->kindOf() == "array") && ($catlist->arraysize() > 0)) \r
                                $category = _getArrayVal($catlist, 0);\r
 \r
+               \r
+               $comments = (int) _getStructVal($struct, 'mt_allow_comments') ? 0 : 1;\r
                $publish = _getScalar($m,4);\r
 \r
-               return _addItem($blogid, $username, $password, $title, $content, '', $publish, 0, $category);\r
+\r
+               // Add item\r
+               $res = _addItem($blogid, $username, $password, $title, $content, $more, $publish, $comments, $category);\r
+               \r
+               // Handle trackbacks\r
+               $trackbacks = array();\r
+               $tblist = $struct->structmem('mt_tb_ping_urls');\r
+               if ($tblist && ($tblist->kindOf() == "array") && ($tblist->arraysize() > 0)) {\r
+                       \r
+                       for ($i = 0; $i < $tblist->arraysize(); $i++) {\r
+                               $trackbacks[] = _getArrayVal($tblist, $i);\r
+                       }\r
+                       \r
+                       $manager->notify('SendTrackback', array ('tb_id' => $itemid, 'urls' => & $trackbacks));\r
+               }\r
+\r
+               return $res;\r
        }\r
        \r
        \r
                        \r
                $publish = _getScalar($m,4);\r
 \r
+               \r
                // get old title and extended part \r
                if (!$manager->existsItem($itemid,1,1))\r
                        return _error(6,"No such item ($itemid)");\r
                        $wasdraft = 0;\r
                }\r
 \r
-               return _edititem($itemid, $username, $password, $catid, $title, $content, $old['more'], $wasdraft, $publish, $old['closed']);\r
+               $more = $struct->structmem('mt_text_more');\r
+               if ($more) {\r
+                       $more = _getStructVal($struct, 'mt_text_more');\r
+               } else {\r
+                       $more = $old['more'];\r
+               }\r
+               \r
+               $comments = $struct->structmem('mt_allow_comments');\r
+               if ($comments) {\r
+                       $comments = (int) _getStructVal($struct, 'mt_allow_comments') ? 0 : 1;\r
+               } else {\r
+                       $comments = $old['closed'];\r
+               }\r
+\r
+               $res = _edititem($itemid, $username, $password, $catid, $title, $content, $more, $wasdraft, $publish, $comments);\r
 \r
+               // Handle trackbacks\r
+               $trackbacks = array();\r
+               $tblist = $struct->structmem('mt_tb_ping_urls');\r
+               if ($tblist && ($tblist->kindOf() == "array") && ($tblist->arraysize() > 0)) {\r
+                       \r
+                       for ($i = 0; $i < $tblist->arraysize(); $i++) {\r
+                               $trackbacks[] = _getArrayVal($tblist, $i);\r
+                       }\r
+                       \r
+                       $manager->notify('SendTrackback', array ('tb_id' => $itemid, 'urls' => & $trackbacks));\r
+               }\r
+\r
+               return $res;\r
        }\r
        \r
        // metaWeblog.newMediaObject\r
 \r
                $structarray = array();         // the array in which the structs will be stored\r
 \r
-               $query = "SELECT mname, ibody, iauthor, ibody, inumber, ititle as title, itime, cname as category"\r
+               $query = "SELECT mname, ibody, imore, iauthor, ibody, inumber, ititle as title, itime, cname as category, iclosed"\r
                           .' FROM '.sql_table('item').', '.sql_table('category').', '.sql_table('member')\r
                           ." WHERE iblog=$blogid and icat=catid and iauthor=mnumber"\r
                           ." ORDER BY itime DESC"\r
                while ($row = mysql_fetch_assoc($r)) {\r
                \r
                        // remove linebreaks if needed\r
-                       if ($blog->convertBreaks())\r
+                       if ($blog->convertBreaks()) {\r
                                $row['ibody'] = removeBreaks($row['ibody']);\r
+                               $row['imore'] = removeBreaks($row['imore']);\r
+                       }\r
 \r
                        $newstruct = new xmlrpcval(array(\r
                                "dateCreated" => new xmlrpcval(iso8601_encode(strtotime($row['itime'])),"dateTime.iso8601"),\r
                                                array(\r
                                                        new xmlrpcval($row['category'], "string")\r
                                                )\r
-                                               ,"array")\r
+                                               ,"array"),\r
+                               \r
+                                               \r
+                               "mt_text_more"          => new xmlrpcval($row['imore'], "string"),\r
+                               "mt_allow_comments" => new xmlrpcval($row['iclosed'] ? 0 : 1, "int"),\r
+                               "mt_allow_pings"        => new xmlrpcval(1, "int")\r
                        ),'struct');\r
                        \r
                //TODO: String link?\r
                //TODO: String permaLink?\r
-               //TODO: String nucleus_more?\r
                \r
                \r
                        array_push($structarray, $newstruct);           \r
                $item =& $manager->getItem($itemid,1,1); // (also allow drafts and future items)\r
                \r
                $b = new BLOG($blogid);\r
-               if ($b->convertBreaks())\r
+               if ($b->convertBreaks()) {\r
                        $item['body'] = removeBreaks($item['body']);\r
+                       $item['more'] = removeBreaks($item['more']);\r
+               }\r
                        \r
                $categoryname = $b->getCategoryName($item['catid']);\r
 \r
                                        array(\r
                                                new xmlrpcval($categoryname, "string")\r
                                        )\r
-                                       ,"array")\r
+                                       ,"array"),\r
+                               \r
+                       "mt_text_more"          => new xmlrpcval($item['more'], "string"),\r
+                       "mt_allow_comments" => new xmlrpcval($item['closed'] ? 0 : 1, "int"),\r
+                       "mt_allow_pings"        => new xmlrpcval(1, "int")\r
                ),'struct');\r
                \r
                //TODO: add "String link" to struct?\r
                //TODO: add "String permaLink" to struct? \r
-               //TODO: add "String nucleus_more" to struct?\r
 \r
                return new xmlrpcresp($newstruct);\r
        \r
index be966df..277e9b0 100755 (executable)
@@ -1,6 +1,6 @@
 <?php\r
 \r
-/*\r
+/*\r
   * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/) \r
   * Copyright (C) 2002-2005 The Nucleus Group\r
   *\r
@@ -9,15 +9,16 @@
   * 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
-  * $Id: api_mt.inc.php,v 1.3 2005-03-12 06:19:06 kimitake Exp $\r
-  * $NucleusJP$\r
   */\r
-\r
-/*\r
+/**\r
  * This file contains definitions for the methods in the Movable Type API\r
  *\r
  * Wouter Demuynck 2003-08-31\r
+ *\r
+ * @license http://nucleuscms.org/license.txt GNU General Public License\r
+ * @copyright Copyright (C) 2002-2005 The Nucleus Group\r
+ * @version $Id: api_mt.inc.php,v 1.3.2.1 2005-08-25 07:04:14 kimitake Exp $\r
+ * @version $NucleusJP: api_mt.inc.php,v 1.3 2005/03/12 06:19:06 kimitake Exp $\r
  */\r
 \r
 \r
        ));\r
        $f_mt_getTrackbackPings_doc = '(this is currently just a placeholder. It returns an empty array.)';\r
        function f_mt_getTrackbackPings($m) {\r
+               global $manager;\r
+\r
                $itemid = intval(_getScalar($m, 0));\r
                                \r
-               return new xmlrpcresp(new xmlrpcval(array(), 'array'));\r
+               $trackbacks = array ();\r
+               $tbstruct   = array ();\r
+                       \r
+               $manager->notify('RetrieveTrackback', array ('tb_id' => $itemid, 'trackbacks' => & $trackbacks));\r
+                               \r
+               while (list(,$v) = each ($trackbacks)) {\r
+                       $tbstruct[] = new xmlrpcval(\r
+                               array(\r
+                                       "pingTitle" => new xmlrpcval($v['title'], "string"),\r
+                                       "pingURL"   => new xmlrpcval($v['url'], "string"),\r
+                                       "pingIP"    => new xmlrpcval($v['ip'], "string")\r
+                               )\r
+                       ,'struct');                     \r
+               }               \r
+                               \r
+               return new xmlrpcresp(new xmlrpcval( $tbstruct , "array"));\r
        }\r
        \r
        $functionDefs = array_merge($functionDefs,\r
index f2434fa..28b48a4 100755 (executable)
@@ -1,5 +1,5 @@
 <?php\r
-/*\r
+/*\r
   * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/) \r
   * Copyright (C) 2002-2005 The Nucleus Group\r
   *\r
@@ -8,15 +8,17 @@
   * 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
-  * $Id: api_nucleus.inc.php,v 1.3 2005-03-12 06:19:06 kimitake Exp $\r
-  * $NucleusJP$\r
   */\r
 \r
-/*\r
+/**\r
  * This file contains definitions for the functions in the Nucleus API\r
  *\r
  * NOTE: These functions are deprecated and will most likely be removed!\r
+ *\r
+ * @license http://nucleuscms.org/license.txt GNU General Public License\r
+ * @copyright Copyright (C) 2002-2005 The Nucleus Group\r
+ * @version $Id: api_nucleus.inc.php,v 1.3.2.1 2005-08-25 07:04:14 kimitake Exp $\r
+ * @version $NucleusJP: api_nucleus.inc.php,v 1.3 2005/03/12 06:19:06 kimitake Exp $\r
  */\r
 \r
        // nucleus.addItem\r
index 863b4d6..03a6421 100755 (executable)
@@ -62,8 +62,8 @@
  *\r
  * @license http://nucleuscms.org/license.txt GNU General Public License\r
  * @copyright Copyright (C) 2002-2005 The Nucleus Group\r
- * @version $Id: server.php,v 1.3.2.1 2005-06-30 21:21:54 kimitake Exp $\r
- * @version $NucleusJP$\r
+ * @version $Id: server.php,v 1.3.2.2 2005-08-25 07:04:14 kimitake Exp $\r
+ * @version $NucleusJP: server.php,v 1.3.2.1 2005/06/30 21:21:54 kimitake Exp $\r
  */\r
 $CONF = array();\r
 include("../../config.php");   // include Nucleus libs and code\r
@@ -298,7 +298,10 @@ function _getScalar($m, $idx) {
 \r
 function _getStructVal($struct, $key) {\r
        $t = $struct->structmem($key);\r
-       return $t->scalarval();\r
+       if (!$t) \r
+               return '';      // no such struct value\r
+       else\r
+               return $t->scalarval();\r
 }\r
 \r
 function _getArrayVal($a, $idx) {\r
index 4ddd643..63192c1 100755 (executable)
@@ -1,47 +1,48 @@
-<nucleusskin>\r
-       <meta>\r
-               <skin name="feeds/atom" />\r
-               <template name="feeds/atom/modified" />\r
-               <template name="feeds/atom/entries" />\r
-       </meta>\r
-\r
-\r
-       <skin name="feeds/atom" type="application/atom+xml" includeMode="normal" includePrefix="">\r
-               <description>Atom 0.3 weblog syndication</description>\r
-               <part name="index"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>\r
-<feed version="0.3" xmlns="http://purl.org/atom/ns#">\r
-    <title><%blogsetting(name)%></title>\r
-    <link rel="alternate" type="text/html" href="<%blogsetting(url)%>" />\r
-    <generator url="http://nucleuscms.org/"><%version%></generator>\r
-    <modified><%blog(feeds/atom/modified,1)%></modified>\r
-    <%blog(feeds/atom/entries,10)%>\r
-</feed>]]></part>\r
-\r
-       </skin>\r
-\r
-\r
-       <template name="feeds/atom/modified">\r
-               <description>Atom feeds: Inserts last modification date</description>\r
-               <part name="ITEM"><![CDATA[<%date(utc)%>]]></part>\r
-\r
-       </template>\r
-\r
-\r
-       <template name="feeds/atom/entries">\r
-               <description>Atom feeds: Feed items</description>\r
-               <part name="ITEM"><![CDATA[<entry>\r
- <title type="text/html" mode="escaped"><![CDATA[<%title%>]]]]><![CDATA[></title>\r
- <link rel="alternate" type="text/html" href="<%blogurl%>?itemid=<%itemid%>" />\r
- <author>\r
-  <name><%author%></name>\r
- </author>\r
- <modified><%date(utc)%></modified>\r
- <issued><%date(iso8601)%></issued>\r
- <content type="text/html" mode="escaped"><![CDATA[<%body%><%more%>]]]]><![CDATA[></content>\r
- <id><%blogurl%>:<%blogid%>:<%itemid%></id>\r
-</entry>]]></part>\r
-\r
-       </template>\r
-\r
-\r
-</nucleusskin>\r
+<nucleusskin>
+       <meta>
+               <skin name="feeds/atom" />
+               <template name="feeds/atom/modified" />
+               <template name="feeds/atom/entries" />
+               <info>
+                       <![CDATA[Atom 0.3 weblog syndication]]>
+               </info>
+       </meta>
+
+       <skin name="feeds/atom" type="application/atom+xml" includeMode="normal" includePrefix="">
+               <description>Atom 0.3 weblog syndication</description>
+               <part name="index"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
+<feed version="0.3" xmlns="http://purl.org/atom/ns#">
+    <title><%blogsetting(name)%></title>
+    <link rel="alternate" type="text/html" href="<%blogsetting(url)%>" />
+    <generator url="http://nucleuscms.org/"><%version%></generator>
+    <modified><%blog(feeds/atom/modified,1)%></modified>
+    <%blog(feeds/atom/entries,10)%>
+</feed>]]></part>
+       </skin>
+
+
+       <template name="feeds/atom/modified">
+               <description>Atom feeds: Inserts last modification date</description>
+               <part name="ITEM"><![CDATA[<%date(utc)%>]]></part>
+       </template>
+
+
+       <template name="feeds/atom/entries">
+               <description>Atom feeds: Feed items</description>
+               <part name="ITEM"><![CDATA[<entry>
+ <title type="text/html" mode="escaped"><![CDATA[<%title%>]]]]><![CDATA[></title>
+ <link rel="alternate" type="text/html" href="<%blogurl%>?itemid=<%itemid%>" />
+ <author>
+  <name><%author%></name>
+ </author>
+ <modified><%date(utc)%></modified>
+ <issued><%date(iso8601)%></issued>
+ <content type="text/html" mode="escaped"><![CDATA[<%body%><%more%>]]]]><![CDATA[></content>
+ <id><%blogurl%>:<%blogid%>:<%itemid%></id>
+</entry>]]></part>
+               <part name="IMAGE_CODE"><![CDATA[<%image%>]]></part>
+               <part name="MEDIA_CODE"><![CDATA[<%media%>]]></part>
+               <part name="POPUP_CODE"><![CDATA[<%media%>]]></part>
+       </template>
+
+</nucleusskin>
index 8c8e09b..a248c86 100755 (executable)
@@ -1,9 +1,9 @@
 <nucleusskin>\r
        <meta>\r
                <skin name="xml/rsd" />\r
+               <info><![CDATA[RSD (Really Simple Discovery) information for weblog clients]]></info>\r
        </meta>\r
 \r
-\r
        <skin name="xml/rsd" type="text/xml" includeMode="normal" includePrefix="">\r
                <description>RSD (Really Simple Discovery) information for weblog clients</description>\r
                <part name="index"><![CDATA[<?xml version="1.0"?>\r
@@ -22,8 +22,6 @@
   </apis>\r
  </service>\r
 </rsd>]]></part>\r
-\r
        </skin>\r
 \r
-\r
-</nucleusskin>
\ No newline at end of file
+</nucleusskin>\r
index 0836b4a..d630f21 100755 (executable)
@@ -2,9 +2,9 @@
        <meta>\r
                <skin name="feeds/rss20" />\r
                <template name="feeds/rss20" />\r
+               <info><![CDATA[RSS 2.0 syndication of weblogs]]></info>\r
        </meta>\r
 \r
-\r
        <skin name="feeds/rss20" type="text/xml" includeMode="normal" includePrefix="">\r
                <description>RSS 2.0 syndication of weblogs</description>\r
                <part name="index"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>\r
     <title><%blogsetting(name)%></title>\r
     <link><%blogsetting(url)%></link>\r
     <description><%blogsetting(desc)%></description>\r
-    <!-- optional tags -->\r
-    <language>ja</language>           <!-- valid langugae goes here -->\r
+    <language>ja</language>\r
     <generator><%version%></generator>\r
-       <copyright>&#169;</copyright>             <!-- Copyright notice -->\r
+    <copyright>&#169;</copyright>\r
     <category>Weblog</category>\r
     <docs>http://backend.userland.com/rss</docs>\r
     <image>\r
-      <url><%adminurl%>nucleus2.gif</url>\r
+               <url><%blogsetting(url)%>/nucleus/nucleus2.gif</url>\r
       <title><%blogsetting(name)%></title>\r
       <link><%blogsetting(url)%></link>\r
     </image>\r
     <%blog(feeds/rss20,10)%>\r
   </channel>\r
 </rss>]]></part>\r
-\r
        </skin>\r
 \r
-\r
        <template name="feeds/rss20">\r
                <description>Used for RSS 2.0 syndication of your blog</description>\r
                <part name="EDITLINK"><![CDATA[<a href="<%editlink%>" onclick="<%editpopupcode%>">edit</a>]]></part>\r
-\r
                <part name="FORMAT_DATE"><![CDATA[%Y-%m-%d]]></part>\r
-\r
                <part name="FORMAT_TIME"><![CDATA[%H:%M:%S]]></part>\r
-\r
                <part name="ITEM"><![CDATA[<item>\r
- <title><![CDATA[<%title%>]]]]><![CDATA[></title>\r
+ <title><![CDATA[<%title(xml)%>]]]]><![CDATA[></title>\r
  <link><%blogurl%>?itemid=<%itemid%></link>\r
 <description><![CDATA[<%body%><%more%>]]]]><![CDATA[></description>\r
  <category><%category%></category>\r
 <comments><%blogurl%>?itemid=<%itemid%></comments>\r
  <pubDate><%date(rfc822)%></pubDate>\r
 </item>]]></part>\r
-\r
+               <part name="IMAGE_CODE"><![CDATA[<%image%>]]></part>\r
+               <part name="MEDIA_CODE"><![CDATA[<%media%>]]></part>\r
+               <part name="POPUP_CODE"><![CDATA[<%media%>]]></part>\r
        </template>\r
 \r
-\r
 </nucleusskin>\r
index f5f7716..17d7383 100755 (executable)
@@ -1,6 +1,6 @@
 <?php\r
 \r
-/**\r
+/*\r
   * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/) \r
   * Copyright (C) 2002-2005 The Nucleus Group\r
   *\r
@@ -9,8 +9,14 @@
   * as published by the Free Software Foundation; either version 2\r
   * of the License, or (at your option) any later version.\r
   * (see nucleus/documentation/index.html#license for more info)\r
-  *\r
+ */\r
+\r
+/**\r
   * Nucleus RSS syndication channel skin\r
+ * @license http://nucleuscms.org/license.txt GNU General Public License\r
+ * @copyright Copyright (C) 2002-2005 The Nucleus Group\r
+ * @version $Id: xml-rss2.php,v 1.4.2.1 2005-08-25 07:04:13 kimitake Exp $\r
+ * @version $NucleusJP$\r
   */\r
 \r
 header("Pragma: no-cache");\r