OSDN Git Service

merged 3.3 beta1
authorkimitake <kimitake@1ca29b6e-896d-4ea0-84a5-967f57386b96>
Mon, 17 Jul 2006 20:05:07 +0000 (20:05 +0000)
committerkimitake <kimitake@1ca29b6e-896d-4ea0-84a5-967f57386b96>
Mon, 17 Jul 2006 20:05:07 +0000 (20:05 +0000)
git-svn-id: https://svn.sourceforge.jp/svnroot/nucleus-jp/nucleus-jp/trunk@149 1ca29b6e-896d-4ea0-84a5-967f57386b96

47 files changed:
utf8/nucleus/documentation/devdocs/custominstall.html
utf8/nucleus/documentation/devdocs/index.html
utf8/nucleus/documentation/devdocs/plugins.html
utf8/nucleus/documentation/devdocs/sqltables.html
utf8/nucleus/documentation/devdocs/xmlrpc.html
utf8/nucleus/documentation/history.html
utf8/nucleus/documentation/index.html
utf8/nucleus/forms/commentform-loggedin.template
utf8/nucleus/forms/commentform-notloggedin.template
utf8/nucleus/forms/loginform-loggedin.template
utf8/nucleus/forms/loginform-notloggedin.template
utf8/nucleus/forms/membermailform-loggedin.template
utf8/nucleus/forms/membermailform-notloggedin.template
utf8/nucleus/forms/nucleusbutton.template
utf8/nucleus/forms/searchform.template
utf8/nucleus/libs/ACTION.php
utf8/nucleus/libs/ACTIONLOG.php
utf8/nucleus/libs/BAN.php
utf8/nucleus/libs/BLOG.php
utf8/nucleus/libs/COMMENT.php
utf8/nucleus/libs/COMMENTACTIONS.php [new file with mode: 0644]
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/SEARCH.php
utf8/nucleus/libs/backup.php
utf8/nucleus/libs/globalfunctions.php
utf8/nucleus/libs/include/admin-add.template
utf8/nucleus/libs/include/admin-edit.template
utf8/nucleus/libs/include/bookmarklet-add.template
utf8/nucleus/libs/include/bookmarklet-edit.template
utf8/nucleus/plugins/NP_SkinFiles.php
utf8/nucleus/styles/addedit.css
utf8/nucleus/styles/admin.css
utf8/nucleus/styles/bookmarklet.css
utf8/nucleus/styles/manual.css
utf8/nucleus/styles/popups.css
utf8/nucleus/upgrades/index.php
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

index 04841d7..ee8316d 100755 (executable)
@@ -1,8 +1,8 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml" lang="ja-JP" xml:lang="ja-JP">
 <head>
-       <!-- $Id: custominstall.html,v 1.5 2006-07-12 07:11:46 kimitake Exp $ -->
-       <!-- $NucleusJP: custominstall.html,v 1.4 2005/03/19 08:34:53 kimitake Exp $ -->
+       <!-- $Id: custominstall.html,v 1.6 2006-07-17 20:02:50 kimitake Exp $ -->
+       <!-- $NucleusJP: custominstall.html,v 1.5 2006/07/12 07:11:46 kimitake Exp $ -->
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <title>Nucleus - インストールスクリプトのカスタマイズ</title>
        <link rel="stylesheet" type="text/css" href="styles/manual.css" />
@@ -64,4 +64,4 @@
 <p>再配布する前に、カスタマイズされたインストールスクリプトをテストすることを忘れないでください。</p>
 
 </body>
-</html>
+</html>
\ No newline at end of file
index 0b401d4..1e6168f 100755 (executable)
@@ -1,8 +1,8 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml" lang="ja-JP" xml:lang="ja-JP">
 <head>
-       <!-- $Id: index.html,v 1.5 2006-07-12 07:11:46 kimitake Exp $ -->
-       <!-- $NucleusJP: index.html,v 1.4 2005/03/19 08:34:53 kimitake Exp $ -->
+       <!-- $Id: index.html,v 1.6 2006-07-17 20:02:50 kimitake Exp $ -->
+       <!-- $NucleusJP: index.html,v 1.5 2006/07/12 07:11:46 kimitake Exp $ -->
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <title>Nucleus - 開発者用ドキュメント</title>
        <link rel="stylesheet" type="text/css" href="styles/manual.css" />
@@ -30,5 +30,4 @@
 </ul>
 
 </body>
-</html>
-
+</html>
\ No newline at end of file
index 8262620..2873bd2 100755 (executable)
@@ -1,18 +1,18 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml" lang="ja-JP" xml:lang="ja-JP">
 <head>
-       <!-- $Id: plugins.html,v 1.7 2006-07-12 07:11:46 kimitake Exp $ -->
-       <!-- $NucleusJP: plugins.html,v 1.6.2.1 2005/09/09 07:34:26 kimitake Exp $ -->
+       <!-- $Id: plugins.html,v 1.8 2006-07-17 20:02:50 kimitake Exp $ -->
+       <!-- $NucleusJP: plugins.html,v 1.7 2006/07/12 07:11:46 kimitake Exp $ -->
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <title>Nucleus - プラグイン API</title>
        <link rel="stylesheet" type="text/css" href="styles/manual.css" />
        <style type="text/css">
                /* refence parameters (greenish) */
                .ref {
-                       background-color: #afa; 
+                       background-color: #afa;
                        color: #000;
                }
-               
+
                /* object parameters */
                .obj {
                        color: #00f;
@@ -20,7 +20,7 @@
                .obj:after {
                        content: " (object)";
                }
-               
+
                /* read-only parameters (non-ref; reddish) */
                .ro {
                        background-color: #faa;
@@ -112,39 +112,38 @@ Nucleusプラグインによって、誰もがNucleusの提供する機能を、
 <p>
 では、シンプルなプラグインを書いてみましょう。基本的にプラグインは、あらかじめ定義された <code>NucleusPlugin</code> クラスを継承したPHPクラスです。以下は<code>HelloWorld</code>プラグインの例です。</p>
 
-<pre class="example"><code>&lt;?
+<pre class="example"><code>&lt;?php
 
 class NP_HelloWorld extends NucleusPlugin
 {
-
        // プラグインの名前
        function getName()
        {
-               return 'Hello World'; 
+               return 'Hello World';
        }
-       
+
        // プラグインの作者
        function getAuthor()
-       { 
-               return 'Wouter Demuynck'; 
+       {
+               return 'Wouter Demuynck';
        }
-       
+
        // プラグインのサイトURL
        // mailto:foo@bar.com の形式も可
-       function getURL() 
+       function getURL()
        {
-               return '../../index.html'; 
+               return 'http://nucleuscms.org/';
        }
-       
+
        // プラグインのバージョン
        function getVersion()
        {
-               return '1.0'; 
+               return '1.0';
        }
-       
+
        // インストール済みのプラグインリストに表示される説明文
        function getDescription()
-       { 
+       {
                return 'Just a sample plugin.';
        }
 
@@ -163,9 +162,9 @@ class NP_HelloWorld extends NucleusPlugin
                                return 0;
                }
        }
-         
+
 }
-?&gt;</pre>
+?&gt;</code></pre>
 
 <ol>
        <li>
@@ -1913,5 +1912,3 @@ http://forum.nucleuscms.org/viewtopic.php?t=&lt;トピックID&gt;&lt;/a&gt;&lt;
 
 </body>
 </html>
-
-
index de22428..bee2418 100755 (executable)
@@ -1,8 +1,8 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml" lang="ja-JP" xml:lang="ja-JP">
 <head>
-       <!-- $Id: sqltables.html,v 1.5 2006-07-12 07:11:46 kimitake Exp $ -->
-       <!-- $NucleusJP: sqltables.html,v 1.4.2.1 2005/09/09 05:25:32 kimitake Exp $ -->
+       <!-- $Id: sqltables.html,v 1.6 2006-07-17 20:02:50 kimitake Exp $ -->
+       <!-- $NucleusJP: sqltables.html,v 1.5 2006/07/12 07:11:46 kimitake Exp $ -->
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <title>Nucleus - SQL テーブル構造</title>
        <link rel="stylesheet" type="text/css" href="styles/manual.css" />
 </head>
 <body>
 
-
 <a name="top" id="top"></a>
+
 <div class="heading">
-  SQLテーブル・リファレンス <i>2005年3月5日</i>
+SQLテーブル・リファレンス
+<i>2005年3月5日</i>
 </div>
 <strong>訳者注:</strong>
 <ul>
     <a href="http://nucleuscms.org/documentation/devdocs/sqltables.html">http://nucleuscms.org/documentation/devdocs/sqltables.html</a></li>
   <li>誤訳にお気づきの方は<a href="http://japan.nucleuscms.org/bb/viewforum.php?f=7">こちら</a>へご連絡いただけると助かります。</li>
 </ul>
+
 <h1>はじめに</h1>
-<p><a href="index.html">開発者向けドキュメントの目次へ戻る</a></p>
-<p>このドキュメントはNucleusのデータベース・テーブルのフィールドを解説しています。</p>
+
+<p>
+<a href="index.html">開発者向けドキュメントの目次へ戻る</a>
+</p>
+
+<p>
+このドキュメントはNucleusのデータベース・テーブルのフィールドを解説しています。
+</p>
+
 <p class="note">構造は<strong>Nucleus v3.2</strong>のものに従っています</p>
+
 <h1><a name="toc" id="toc"></a>目次</h1>
 <ul>
-  <li><a href="#legend">文書中の色使いについて</a></li>
-  <li>Blog
-    <ul>
-      <li><a href="#nucleus_blog">nucleus_blog</a></li>
-      <li><a href="#nucleus_category">nucleus_category</a></li>
-      <li><a href="#nucleus_item">nucleus_item</a></li>
-      <li><a href="#nucleus_comment">nucleus_comment</a></li>
-      <li><a href="#nucleus_member">nucleus_member</a></li>
-      <li><a href="#nucleus_team">nucleus_team</a></li>
-    </ul>
-  </li>
-  <li>プラグイン
-    <ul>
-      <li><a href="#nucleus_plugin">nucleus_plugin</a></li>
-      <li><a href="#nucleus_plugin_event">nucleus_plugin_event</a></li>
-      <li><a href="#nucleus_plugin_option">nucleus_plugin_option</a></li>
-      <li><a href="#nucleus_plugin_option_desc">nucleus_plugin_option_desc</a></li>
-    </ul>
-  </li>
-  <li>スキンとテンプレート
-    <ul>
-      <li><a href="#nucleus_skin">nucleus_skin</a></li>
-      <li><a href="#nucleus_skin_desc">nucleus_skin_desc</a></li>
-      <li><a href="#nucleus_template">nucleus_template</a></li>
-      <li><a href="#nucleus_template_desc">nucleus_template_desc</a></li>
-    </ul>
-  </li>
-  <li>管理
-    <ul>
-      <li><a href="#nucleus_actionlog">nucleus_actionlog</a></li>
-      <li><a href="#nucleus_config">nucleus_config</a>
-        <ul>
-          <li><a href="#nucleus_config_options">可能なオプション</a></li>
-        </ul>
-      </li>
-      <li><a href="#nucleus_tickets">nucleus_tickets</a></li>
-      <li><a href="#nucleus_activation">nucleus_activation</a></li>
-    </ul>
-  </li>
-  <li>その他
-    <ul>
-      <li><a href="#nucleus_karma">nucleus_karma</a></li>
-      <li><a href="#nucleus_ban">nucleus_ban</a></li>
-    </ul>
-  </li>
+       <li><a href="#legend">文書中の色使いについて</a></li>
+       <li>
+
+               Blog
+
+               <ul>
+                       <li><a href="#nucleus_blog">nucleus_blog</a></li>
+                       <li><a href="#nucleus_category">nucleus_category</a></li>
+                       <li><a href="#nucleus_item">nucleus_item</a></li>
+                       <li><a href="#nucleus_comment">nucleus_comment</a></li>
+                       <li><a href="#nucleus_member">nucleus_member</a></li>
+                       <li><a href="#nucleus_team">nucleus_team</a></li>
+               </ul>
+       </li>
+       <li>
+               プラグイン
+               <ul>
+                       <li><a href="#nucleus_plugin">nucleus_plugin</a></li>
+                       <li><a href="#nucleus_plugin_event">nucleus_plugin_event</a></li>
+                       <li><a href="#nucleus_plugin_option">nucleus_plugin_option</a></li>
+                       <li><a href="#nucleus_plugin_option_desc">nucleus_plugin_option_desc</a></li>
+               </ul>
+       </li>
+       <li>
+               スキンとテンプレート
+               <ul>
+                       <li><a href="#nucleus_skin">nucleus_skin</a></li>
+                       <li><a href="#nucleus_skin_desc">nucleus_skin_desc</a></li>
+                       <li><a href="#nucleus_template">nucleus_template</a></li>
+                       <li><a href="#nucleus_template_desc">nucleus_template_desc</a></li>
+               </ul>
+       </li>
+       <li>
+               管理
+               <ul>
+                       <li><a href="#nucleus_actionlog">nucleus_actionlog</a></li>
+                       <li>
+                               <a href="#nucleus_config">nucleus_config</a>
+                               <ul>
+                                       <li><a href="#nucleus_config_options">可能なオプション</a></li>
+                               </ul>
+                       </li>
+                       <li><a href="#nucleus_tickets">nucleus_tickets</a></li>
+                       <li><a href="#nucleus_activation">nucleus_activation</a></li>
+               </ul>
+       </li>
+       <li>
+               その他
+   <ul>
+               <ul>
+                       <li><a href="#nucleus_karma">nucleus_karma</a></li>
+                       <li><a href="#nucleus_ban">nucleus_ban</a></li>
+               </ul>
+       </li>
+
+
 </ul>
+
 <a id="legend" name="legend"></a>
 <h1>色使い<a href="#top" class="toplink"><img src="../icon-up.gif" alt="back to top" width="15" height="15"></a></h1>
+
 <p>この文書中では、カラムの型を示すために、文字の修飾を使っています。以下に例を示します:</p>
-<table width="893">
-  <tbody>
-    <tr>
-      <td class="primary" width="88">プライマリ</td>
-      <td width="775">プライマリキー</td>
-    </tr>
-    <tr>
-      <td class="foreign" width="88">外部</td>
-      <td width="775">外部キー(クリックすると参照先に飛ぶ)。MySQLは外部キーとの一貫性保持に責任を持たないことに注意</td>
-    </tr>
-    <tr>
-      <td class="toremove" width="88">削除予定</td>
-      <td width="775">同じ機能を提供するプラグインを優先するため、テーブルやカラムは将来のバージョンのNucleusで削除させる可能性が高い</td>
-    </tr>
-    <tr>
-      <td class="fulltext" width="88">フルテキスト</td>
-      <td width="775">カラムにフルテキストのインデックスが付く(検索で使用する)</td>
-    </tr>
-  </tbody>
-</table>
+
+<table width="893"><tr>
+       <td class="primary" width="88">プライマリ</td>
+       <td width="775">プライマリキー</td>
+</tr><tr>
+       <td class="foreign" width="88">外部</td>
+       <td width="775">外部キー(クリックすると参照先に飛ぶ)。MySQLは外部キーとの一貫性保持に責任を持たないことに注意</td>
+</tr><tr>
+       <td class="toremove" width="88">削除予定</td>
+       <td width="775">同じ機能を提供するプラグインを優先するため、テーブルやカラムは将来のバージョンのNucleusで削除させる可能性が高い</td>
+</tr><tr>
+       <td class="fulltext" width="88">フルテキスト</td>
+       <td width="775">カラムにフルテキストのインデックスが付く(検索で使用する)</td>
+</tr></table>
+
+
 <a id="nucleus_blog" name="nucleus_blog"></a>
 <h1>nucleus_blogテーブル<a href="#top" class="toplink"><img src="../icon-up.gif" alt="back to top" width="15" height="15"></a></h1>
-<table>
-  <tbody>
-    <tr>
-      <th>カラム名</th>
-      <th>型</th>
-      <th>既定値</th>
-      <th>説明</th>
-    </tr>
-    <tr>
-      <td class="notnull autoinc primary">bnumber</td>
-      <td>int(11)</td>
-      <td></td>
-      <td>BlogのID</td>
-    </tr>
-    <tr>
-      <td class="notnull">bname</td>
-      <td>varchar(60)</td>
-      <td>''</td>
-      <td>Blog名</td>
-    </tr>
-    <tr>
-      <td class="notnull unique">bshortname</td>
-      <td>varchar(15)</td>
-      <td>''</td>
-      <td>Blogの短縮名 (スキン変数 <code>&lt;%blog%&gt;</code>などで使うものと同じ)</td>
-    </tr>
-    <tr>
+
+<table><tr>
+       <th>カラム名</th>
+       <th>型</th>
+       <th>既定値</th>
+       <th>説明</th>
+
+</tr><tr>
+       <td class="notnull autoinc primary">bnumber</td>
+       <td>int(11)</td>
+       <td></td>
+       <td>BlogのID</td>
+
+</tr><tr>
+       <td class="notnull">bname</td>
+       <td>varchar(60)</td>
+       <td>''</td>
+       <td>Blog名</td>
+
+</tr><tr>
+       <td class="notnull unique">bshortname</td>
+       <td>varchar(15)</td>
+       <td>''</td>
+       <td>Blogの短縮名 (スキン変数 <code>&lt;%blog%&gt;</code>などで使うものと同じ)</td>
+</tr><tr>
       <td>bdesc</td>
       <td>varchar(200)</td>
       <td>NULL</td>
 
 <p>新しいメンバーが登録された時点では、そのメンバーアカウントがアクティベートされるまで Nucleus はログインを許可しない。アクティベートのためのリンクを含むメールが送信され、これによってアクティベートすることができる。<code>nucleus_activation</code>テーブルはアクティベートの進捗状況を追跡する。</p>
 
-<table>
-    <tr>
-      <th>カラム名</th>
-      <th>型</th>
-      <th>既定値</th>
-      <th>説明</th>
-    </tr>
-    <tr>
-      <td class="notnull primary">vkey</td>
-      <td>varchar(40)</td>
-      <td></td>
-      <td>アクティベートキー。このキーはメンバーのアクティベートコードに渡される。一般的に、キーは次のような形になる: <code>41cf637d4fbeeff954b4ca70b8bde9dd</code></td>
-    </tr>
-    <tr>
-      <td class="notnull foreign"><a href="#nucleus_member">vmember</a></td>
-      <td>int(11)</td>
-      <td></td>
-      <td>アクティベートの必要があるメンバー。</td>
-    </tr>
-    <tr>
-      <td class="notnull">vtime</td>
-      <td>datetime</td>
-      <td></td>
-      <td>アクティベートキーが発行された日時。アクティベートキーの有効期間は 2日間である。</td>
-    </tr>
-    <tr>
-      <td class="notnull">vtype</td>
-      <td>varchar(15)</td>
-      <td></td>
-      <td>アクティベートの種別。
-          <ul>
-            <li><code>forgot</code>: パスワードを忘れたメンバー。</li>
-            <li><code>register</code>: 新しく登録されたメンバー。</li>
-            <li><code>addresschange</code>: メールアドレスを変更したメンバー。</li>
-          </ul>
-      </td>
-    </tr>
-    <tr>
-      <td class="notnull">vextra</td>
-      <td>varchar(128)</td>
-      <td></td>
-      <td>追加的な情報。アクティベート種別が <code>addresschange</code> の場合、ここには <code>oldemailaddress/x</code> として、x には 0 または 1 の値が入る。x は <a href="#nucleus_member">member</a>テーブルにある <code>mcanlogin</code> の値を参照する。(アクティベートが完全に終了するまで、このユーザはログインできない)</td>
-    </tr>
-</table>
+<table><tr>
+       <th>カラム名</th>
+       <th>型</th>
+       <th>既定値</th>
+       <th>説明</th>
+</tr><tr>
+       <td class="notnull primary">vkey</td>
+       <td>varchar(40)</td>
+       <td></td>
+       <td>アクティベートキー。このキーはメンバーのアクティベートコードに渡される。一般的に、キーは次のような形になる: <code>41cf637d4fbeeff954b4ca70b8bde9dd</code></td>
+</tr><tr>
+       <td class="notnull foreign"><a href="#nucleus_member">vmember</a></td>
+       <td>int(11)</td>
+       <td></td>
+       <td>アクティベートの必要があるメンバー。</td>
+</tr><tr>
+       <td class="notnull">vtime</td>
+       <td>datetime</td>
+       <td></td>
+       <td>アクティベートキーが発行された日時。アクティベートキーの有効期間は 2日間である。</td>
+</tr><tr>
+       <td class="notnull">vtype</td>
+       <td>varchar(15)</td>
+       <td></td>
+       <td>アクティベートの種別。
+               <ul>
+                       <li><code>forgot</code>: パスワードを忘れたメンバー。</li>
+                       <li><code>register</code>: 新しく登録されたメンバー。</li>
+                       <li><code>addresschange</code>: メールアドレスを変更したメンバー。</li>
+               </ul>
+       </td>
+</tr><tr>
+       <td class="notnull">vextra</td>
+       <td>varchar(128)</td>
+       <td></td>
+       <td>追加的な情報。アクティベート種別が <code>addresschange</code> の場合、ここには <code>oldemailaddress/x</code> として、x には 0 または 1 の値が入る。x は <a href="#nucleus_member">member</a>テーブルにある <code>mcanlogin</code> の値を参照する。(アクティベートが完全に終了するまで、このユーザはログインできない)</td>
+</tr></table>
+
 
 <a id="nucleus_karma" name="nucleus_karma"></a>
 <h1>nucleus_karmaテーブル<a href="#top" class="toplink"><img src="../icon-up.gif" alt="back to top" width="15" height="15"></a></h1>
+
 <p class="toremove">このテーブルは将来はなくなる可能性が高い。同じ機能を提供するプラグインに譲るためだ。</p>
+
 <p>この表は投票に使われたIPアドレスを記憶しておく。こうすることで一つのIPアドレスからは1票しか入れられなくなる</p>
-<table>
-  <tbody>
-    <tr>
-      <th>カラム名</th>
-      <th>型</th>
-      <th>既定値</th>
-      <th>説明</th>
-    </tr>
-    <tr>
-      <td class="notnull foreign"><a href="#nucleus_item">itemid</a></td>
-      <td>int(11)</td>
-      <td>'0'</td>
-      <td>アイテムのID</td>
-    </tr>
-    <tr>
-      <td class="notnull">ip</td>
-      <td>char(15)</td>
-      <td>''</td>
-      <td>投票者のIPアドレス</td>
-    </tr>
-  </tbody>
-</table>
+
+<table><tr>
+       <th>カラム名</th>
+       <th>型</th>
+       <th>既定値</th>
+       <th>説明</th>
+</tr><tr>
+       <td class="notnull foreign"><a href="#nucleus_item">itemid</a></td>
+       <td>int(11)</td>
+       <td>'0'</td>
+       <td>アイテムのID</td>
+
+</tr><tr>
+       <td class="notnull">ip</td>
+       <td>char(15)</td>
+       <td>''</td>
+       <td>投票者のIPアドレス</td>
+</tr></table>
+
 <a id="nucleus_ban" name="nucleus_ban"></a>
 <h1>nucleus_banテーブル<a href="#top" class="toplink"><img src="../icon-up.gif" alt="back to top" width="15" height="15"></a></h1>
+
 <p class="toremove">このテーブルは将来のNucleusではなくなる可能性が高い。同じ機能を提供するプラグインに譲るためだ。</p>
+
 <p>コメントやカルマ投票を禁止するIPアドレスを記憶</p>
-<table>
-  <tbody>
-    <tr>
-      <th>カラム名</th>
-      <th>型</th>
-      <th>既定値</th>
-      <th>説明</th>
-    </tr>
-    <tr>
-      <td class="notnull">iprange</td>
-      <td>varchar(15)</td>
-      <td>''</td>
-      <td>IPアドレスの範囲。アドレス単独でもいいし,一部(左から)でもいい。一部の場合は範囲を示す</td>
-    </tr>
-    <tr>
-      <td class="notnull">reason</td>
-      <td>varchar(255)</td>
-      <td>''</td>
-      <td>禁止の理由を示すメッセージ。コメントやカルマ投票を試みたときに表示される</td>
-    </tr>
-    <tr>
-      <td class="notnull foreign"><a href="#nucleus_blog">blogid</a></td>
-      <td>int(11)</td>
-      <td>'0'</td>
-      <td>禁止を有効にするBlogのID</td>
-    </tr>
-  </tbody>
-</table>
 
-</body>
+<table><tr>
+       <th>カラム名</th>
+       <th>型</th>
+       <th>既定値</th>
+       <th>説明</th>
+</tr><tr>
+       <td class="notnull">iprange</td>
+       <td>varchar(15)</td>
+       <td>''</td>
+       <td>IPアドレスの範囲。アドレス単独でもいいし,一部(左から)でもいい。一部の場合は範囲を示す</td>
 
-</html>
+</tr><tr>
+       <td class="notnull">reason</td>
+       <td>varchar(255)</td>
+       <td>''</td>
+       <td>禁止の理由を示すメッセージ。コメントやカルマ投票を試みたときに表示される</td>
+</tr><tr>
+       <td class="notnull foreign"><a href="#nucleus_blog">blogid</a></td>
+       <td>int(11)</td>
+       <td>'0'</td>
+       <td>禁止を有効にするBlogのID</td>
+</tr></table>
 
+
+</body>
+</html>
\ No newline at end of file
index 6b76072..9f8473f 100755 (executable)
@@ -1,8 +1,8 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml" lang="ja-JP" xml:lang="ja-JP">
 <head>
-       <!-- $Id: xmlrpc.html,v 1.6 2006-07-12 07:11:46 kimitake Exp $ -->
-       <!-- $NucleusJP: xmlrpc.html,v 1.5.2.1 2005/09/09 07:34:26 kimitake Exp $ -->
+       <!-- $Id: xmlrpc.html,v 1.7 2006-07-17 20:02:50 kimitake Exp $ -->
+       <!-- $NucleusJP: xmlrpc.html,v 1.6 2006/07/12 07:11:46 kimitake Exp $ -->
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <title>Nucleus - XML-RPC インターフェイス</title>
        <link rel="stylesheet" type="text/css" href="styles/manual.css" />
@@ -27,7 +27,6 @@ XML-RPC インターフェイス
 NucleusにおけるXML-RPCインターフェイスのURLは以下のようになります:
 <br />
 <b>http://www.yourserver.com/yourpath/nucleus/xmlrpc/server.php</b>
-
 </div>
 
 <a name="bloggerApi" id="bloggerApi"></a>
@@ -44,11 +43,9 @@ Nucleusは<a href="http://www.blogger.com/developers/api/1_docs/">Blogger API</a
 <ul>
        <li><b><a href="http://www.blogger.com/developers/api/1_docs/xmlrpc_newPost.html">blogger.newPost</a></b></li>
        <li><b><a href="http://www.blogger.com/developers/api/1_docs/xmlrpc_editPost.html">blogger.editPost</a></b></li>
-
        <li><b><a href="http://groups.yahoo.com/group/bloggerDev/message/296">blogger.getPost</a></b></li>
        <li><b><a href="http://groups.yahoo.com/group/bloggerDev/message/147">blogger.deletePost</a></b></li>
        <li><b><a href="http://www.blogger.com/developers/api/1_docs/xmlrpc_getUsersBlogs.html">blogger.getUsersBlogs</a></b></li>
-
        <li><b><a href="http://groups.yahoo.com/group/bloggerDev/message/225">blogger.getRecentPosts</a></b></li>
        <li><b><a href="http://groups.yahoo.com/group/bloggerDev/message/315">blogger.getUserInfo</a></b></li>
        <li><b><a href="http://www.blogger.com/developers/api/1_docs/xmlrpc_getTemplate.html">blogger.getTemplate</a></b></li>
@@ -79,9 +76,7 @@ Nucleusは内部的に異なる実装を用いているため、パラメータ
 Nucleus v1.1以降、<a href="http://www.xmlrpc.com/metaWeblogApi">metaWeblog API</a>もサポートされました。これはBlogger APIの拡張版です。 
 </p>
 
-<p>
-Nucleus v2.5では <code>newMediaObject</code> と <code>getRecentPosts</code> の二つのメソッドにも対応しました(これらは最初のmetaWeblog仕様には存在しませんでした)。
-</p>
+<p>Nucleus v2.5では <code>newMediaObject</code> と <code>getRecentPosts</code> の二つのメソッドにも対応しました(これらは最初のmetaWeblog仕様には存在しませんでした)。</p>
 
 <p>
 利用可能なメソッド一覧は以下の通りです(<a href="http://www.xmlrpc.com/metaWeblogApi">specification</a>に詳しい情報があります):
@@ -89,12 +84,11 @@ Nucleus v2.5では <code>newMediaObject</code> と <code>getRecentPosts</code> 
 
 <ul>
        <li>metaWeblog.newPost</li>
-       <li>metaWeblog.editPost</li>    
-       <li>metaWeblog.getPost</li>     
-       <li>metaWeblog.getCategories</li>       
+       <li>metaWeblog.editPost</li>
+       <li>metaWeblog.getPost</li>
+       <li>metaWeblog.getCategories</li>
        <li>metaWeblog.newMediaObject (v2.5)</li>
-       <li>metaWeblog.getRecentPosts (v2.5)</li>       
-
+       <li>metaWeblog.getRecentPosts (v2.5)</li>
 </ul>
 
 <p>Nucleus v3.22以降、<code>mt_text_more</code> と <code>m_tallow_comment</code>もサポートされました。これはmetaWeblog API の拡張版です。つまりこれらの拡張機能をサポートするアプリケーション、例えば Ectoなど、を使用した場合、「続き」を編集することができ、アイテムにコメントを許可するかどうかを決定することができるようになる、ということです。</p>
@@ -108,14 +102,12 @@ Nucleus v2.5では <code>newMediaObject</code> と <code>getRecentPosts</code> 
 
 <ul>
        <li>mt.supportedMethods</li>
-
        <li>mt.supportedTextFilters</li>
        <li>mt.publishPost</li>
        <li>mt.getCategoryList</li>
        <li>mt.getPostCategories</li>
        <li>mt.setPostCategories</li>
        <li>mt.getRecentPostTitles</li>
-
        <li>mt.getTrackbackPings</li>
 </ul>
 
@@ -136,7 +128,6 @@ Nucleus v2.5では <code>newMediaObject</code> と <code>getRecentPosts</code> 
 
 <table>
        <tr>
-
                <th>エラーコード</th>
                <th>エラーメッセージ</th>
        </tr>
@@ -145,7 +136,6 @@ Nucleus v2.5では <code>newMediaObject</code> と <code>getRecentPosts</code> 
                <td>Login Error <br />
                ログインエラー(ユーザ名とパスワードの組み合わせが正しくないと推測されます)</td>
        </tr>
-
        <tr>
                <td>802</td>
                <td>No Such Blog<br />
@@ -155,7 +145,6 @@ Nucleus v2.5では <code>newMediaObject</code> と <code>getRecentPosts</code> 
                <td>803</td>
                <td>Not a Team Member<br />
                チームに登録されていません</td>
-
        </tr>
        <tr>
                <td>804</td>
@@ -164,7 +153,6 @@ Nucleus v2.5では <code>newMediaObject</code> と <code>getRecentPosts</code> 
        </tr>
        <tr>
                <td>805</td>
-
                <td>Amount parameter must be in range 1..20<br />
                パラメータの値は 1..20 の範囲でなければなりません(<i>getRecentItems</i></td>
        </tr>
@@ -173,7 +161,6 @@ Nucleus v2.5では <code>newMediaObject</code> と <code>getRecentPosts</code> 
                <td>No Such Item<br />
                指定されたアイテムは存在しません</td>
        </tr>
-
        <tr>
                <td>807</td>
                <td>Not Allowed to Alter Item<br />
@@ -183,8 +170,7 @@ Nucleus v2.5では <code>newMediaObject</code> と <code>getRecentPosts</code> 
                <td>808</td>
                <td>Invalid media type<br />
                メディアタイプが不正です</td>
-
-       </tr>   
+       </tr>
        <tr>
                <td>809</td>
                <td>File is too large<br />
@@ -212,4 +198,4 @@ Nucleus v2.5では <code>newMediaObject</code> と <code>getRecentPosts</code> 
 </table>
 
 </body>
-</html>
+</html>
\ No newline at end of file
index 41357db..7e95eb1 100755 (executable)
@@ -1,8 +1,8 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml" lang="ja-JP" xml:lang="ja-JP">
 <head>
-       <!-- $Id: history.html,v 1.5 2006-07-12 07:11:46 kimitake Exp $ -->
-       <!-- $NucleusJP: history.html,v 1.3.2.3 2006/05/23 20:38:40 kimitake Exp $ -->
+       <!-- $Id: history.html,v 1.6 2006-07-17 20:02:50 kimitake Exp $ -->
+       <!-- $NucleusJP: history.html,v 1.5 2006/07/12 07:11:46 kimitake Exp $ -->
        <title>Nucleus - History</title>
        <link rel="stylesheet" type="text/css" href="styles/manual.css" />
 </head>
 
 <ul>
        <li>
+               <b>Nucleus v3.3 &quot;Lithium&quot; (Beta - July 8, 2006)</b>
+               <ul>
+                       <li>FIXED (<a href="http://dev.nucleuscms.org/tracker/index.php?id=80&amp;do=details">#80</a>): Atom 1.0 support (rakaz)</li>
+                       <li>FIXED (<a href="http://dev.nucleuscms.org/tracker/index.php?id=129&amp;do=details">#129</a>): Plugin API: SpamCheck event called from core. (rakaz)</li>
+                       <li>FIXED (<a href="http://dev.nucleuscms.org/tracker/index.php?id=128&amp;do=details">#128</a>): Don't show DISALLOWED(XXXX) errors (karma)</li>
+                       <li>FIXED (<a href="http://dev.nucleuscms.org/tracker/index.php?id=127&amp;do=details">#127</a>): parse_commentform: double-escaped URLs (karma)</li>
+                       <li>FIXED (<a href="http://dev.nucleuscms.org/tracker/index.php?id=121&amp;do=details">#121</a>): backup fails when <code>$plugin->getTableList()</code> doesn't return an array (karma)</li>
+                       <li>FIXED (<a href="http://dev.nucleuscms.org/tracker/index.php?id=118&amp;do=details">#118</a>): Errors in default skin (legolas)</li>
+                       <li>ADDED (<a href="http://dev.nucleuscms.org/tracker/index.php?id=119&amp;do=details">#119</a>): Added optional includeMode/includePrefix parameters to <code>parseFile()</code> (karma)</li>
+                       <li>FIXED (<a href="http://dev.nucleuscms.org/tracker/index.php?id=115&amp;do=details">#115</a>): Redundant database queries on member table (karma)</li>
+                       <li>FIXED (<a href="http://dev.nucleuscms.org/tracker/index.php?id=114&amp;do=details">#114</a>): Magic quotes not correctly undone when <code>magic_quotes_sybase</code> enabled (karma)</li>
+                       <li>FIXED (<a href="http://dev.nucleuscms.org/tracker/index.php?id=104&amp;do=details">#104</a>): Return to blogsettings - link missing on edit category</li>
+                       <li>FIXED (<a href="http://dev.nucleuscms.org/tracker/index.php?id=107&amp;do=details">#107</a>): Better path detection in install.php (dekarma)</li>
+                       <li>FIXED (<a href="http://dev.nucleuscms.org/tracker/index.php?id=106&amp;do=details">#106</a>): Make 'Log Out' link under Comment box work with Fancy URLs (Wendy Smoak)</li>
+                       <li>FIXED (<a href="http://dev.nucleuscms.org/tracker/index.php?id=99&amp;do=details">#99</a>): Use workaround when the only installed MySQL PHP extension is mysqli (dekarma)</li>
+                       <li>FIXED (<a href="http://dev.nucleuscms.org/tracker/index.php?id=98&amp;do=details">#98</a>): More "Fatal error: Only variables can be passed by reference" occurrences on some installations (pete)</li>
+                       <li>ADDED (<a href="http://dev.nucleuscms.org/tracker/index.php?id=23&amp;do=details">#23</a>): adding email/url + email field display in blog comment list (admun)</li>
+                       <li>FIXED (<a href="http://dev.nucleuscms.org/tracker/index.php?do=details&amp;id=12">#12</a>): item id and timestamp were not sent along with <code>GenerateURL</code> event when <code>itemlink</code> called from commentvars (karma)</li>
+                       <li>CHANGED: Now using XML-RPC for PHP (phpxmlrpc) v1.2.1</li>
+                       <li>FIXED: (<a href="http://dev.nucleuscms.org/tracker/index.php?do=details&amp;id=97">#97</a>): file uploads didn't check <code>$_FILES['file']['error']</code> codes. (dekarma)</li>
+                       <li>CHANGED: Update user instruction for Blogger conversion tool</li>
+                       <li>ADDED: When an e-mail is provided in the comment-form it is validated. (TeRanEX)</li>
+                       <li>ADDED (<a href="http://dev.nucleuscms.org/tracker/index.php?id=23&amp;do=details">#23</a>): Splitted the URL &amp; E-mail field in comments. (gRegor, ketsugi, Red Dalek, TeRanEX)</li>
+                       <li>ADDED: (bug 817364): delete member enhancement (admun)</li>
+                       <li>ADDED: Auto save draft (Legolas)</li>
+                       <li>ADDED: Custom skin parts (tutorio)</li>
+               </ul>
+       </li>
+       <li>
                <b>Nucleus v3.23 (May 23, 2006)</b>
                <ul>
                        <li>FIXED: Remote code execution vulnerability (reported by rgod).</li>
                <ul>
                        <li>FIXED: Major security vulnerability in the phpxmlrpc library.</li>
                        <li>FIXED: New NP_SkinFiles version, fixing a minor security issue. (rakaz)</li>
-                       <li>CHANGED (<a href="http://dev.nucleuscms.org/tracker/index.php?do=details&id=17">#17</a>): An errormessage is now displayed when logon through loginform failed. (karma)</li>
-                       <li>FIXED (<a href="http://dev.nucleuscms.org/tracker/index.php?do=details&id=91">#91</a>): Initialize variables in MEMBER class (andrew)</li>
-                       <li>FIXED (<a href="http://dev.nucleuscms.org/tracker/index.php?do=details&id=90">#90</a>): there was no plugin callback on member edits when the email address changed (andrew)</li>
-                       <li>FIXED (<a href="http://dev.nucleuscms.org/tracker/index.php?do=details&id=90">#90</a>): when editing members other than yourself, you shouldn't be logged out (andrew)</li>
-                       <li>FIXED (<a href="http://dev.nucleuscms.org/tracker/index.php?do=details&id=85">#85</a>): If both <code>itemid</code> and <code>catid</code> are specified in the URL, ignore <code>catid</code> if it doesn't match <code>itemid</code> (karma)</li>
-                       <li>FIXED (<a href="http://dev.nucleuscms.org/tracker/index.php?do=details&id=49">#49</a>): 'name clashes' warning on skin import no longer displayed when no clashes detected (karma)</li>
-                       <li>FIXED (<a href="http://dev.nucleuscms.org/tracker/index.php?do=details&id=67">#67</a>): Add resilency to upgrade scripts (Frankenstein)</li>
-                       <li>FIXED (<a href="http://dev.nucleuscms.org/tracker/index.php?do=details&id=88">#88</a>): PHP5.1: "Fatal error: Only variables can be passed by reference" (karma)</li>
-                       <li>FIXED (<a href="http://dev.nucleuscms.org/tracker/index.php?do=details&id=87">#87</a>): Translate &amp; -> &amp;amp; when links added via toolbar (karma)</li>
-                       <li>FIXED (<a href="http://dev.nucleuscms.org/tracker/index.php?do=details&id=42">#42</a>): <code>formatDate</code> didn't always use the correct timezone (karma)</li>
-                       <li>FIXED (<a href="http://dev.nucleuscms.org/tracker/index.php?do=details&id=43">#43</a>): Only load user language file when logged in (karma).</li>
-                       <li>FIXED (<a href="http://dev.nucleuscms.org/tracker/index.php?do=details&id=76">#76</a>): Disabling site blocked admin menu access (karma).</li>
-                       <li>FIXED (<a href="http://dev.nucleuscms.org/tracker/index.php?do=details&id=57">#57</a>): PostRegister event not fired from inside admin area.</li>
-                       <li>FIXED (<a href="http://dev.nucleuscms.org/tracker/index.php?do=details&id=58">#58</a>): images and popups were not in feeds. (karma)</li>
-                       <li>FIXED (<a href="http://dev.nucleuscms.org/tracker/index.php?do=details&id=33">#33</a>): add item form invalid ticket error (admun)</li>
+                       <li>CHANGED (<a href="http://dev.nucleuscms.org/tracker/index.php?do=details&amp;id=17">#17</a>): An errormessage is now displayed when logon through loginform failed. (karma)</li>
+                       <li>FIXED (<a href="http://dev.nucleuscms.org/tracker/index.php?do=details&amp;id=91">#91</a>): Initialize variables in MEMBER class (andrew)</li>
+                       <li>FIXED (<a href="http://dev.nucleuscms.org/tracker/index.php?do=details&amp;id=90">#90</a>): there was no plugin callback on member edits when the email address changed (andrew)</li>
+                       <li>FIXED (<a href="http://dev.nucleuscms.org/tracker/index.php?do=details&amp;id=90">#90</a>): when editing members other than yourself, you shouldn't be logged out (andrew)</li>
+                       <li>FIXED (<a href="http://dev.nucleuscms.org/tracker/index.php?do=details&amp;id=85">#85</a>): If both <code>itemid</code> and <code>catid</code> are specified in the URL, ignore <code>catid</code> if it doesn't match <code>itemid</code> (karma)</li>
+                       <li>FIXED (<a href="http://dev.nucleuscms.org/tracker/index.php?do=details&amp;id=49">#49</a>): 'name clashes' warning on skin import no longer displayed when no clashes detected (karma)</li>
+                       <li>FIXED (<a href="http://dev.nucleuscms.org/tracker/index.php?do=details&amp;id=67">#67</a>): Add resilency to upgrade scripts (Frankenstein)</li>
+                       <li>FIXED (<a href="http://dev.nucleuscms.org/tracker/index.php?do=details&amp;id=88">#88</a>): PHP5.1: "Fatal error: Only variables can be passed by reference" (karma)</li>
+                       <li>FIXED (<a href="http://dev.nucleuscms.org/tracker/index.php?do=details&amp;id=87">#87</a>): Translate &amp; -> &amp;amp; when links added via toolbar (karma)</li>
+                       <li>FIXED (<a href="http://dev.nucleuscms.org/tracker/index.php?do=details&amp;id=42">#42</a>): <code>formatDate</code> didn't always use the correct timezone (karma)</li>
+                       <li>FIXED (<a href="http://dev.nucleuscms.org/tracker/index.php?do=details&amp;id=43">#43</a>): Only load user language file when logged in (karma).</li>
+                       <li>FIXED (<a href="http://dev.nucleuscms.org/tracker/index.php?do=details&amp;id=76">#76</a>): Disabling site blocked admin menu access (karma).</li>
+                       <li>FIXED (<a href="http://dev.nucleuscms.org/tracker/index.php?do=details&amp;id=57">#57</a>): PostRegister event not fired from inside admin area.</li>
+                       <li>FIXED (<a href="http://dev.nucleuscms.org/tracker/index.php?do=details&amp;id=58">#58</a>): images and popups were not in feeds. (karma)</li>
+                       <li>FIXED (<a href="http://dev.nucleuscms.org/tracker/index.php?do=details&amp;id=33">#33</a>): add item form invalid ticket error (admun)</li>
                        <li>FIXED: Most buttons of the toolbar reset the scroll position of the textarea to the top in Firefox (leonbloy)</li>
-                       <li>ADDED (<a href="http://dev.nucleuscms.org/tracker/index.php?do=details&id=64">#64</a>): Applications that use the metaweblogAPI, such as Ecto can now also access and edit the extended body (rakaz)</li>
-                       <li>FIXED (<a href="http://dev.nucleuscms.org/tracker/index.php?do=details&id=63">#63</a>): _getArrayVal() always returned first element of array (rakaz)</li>
+                       <li>ADDED (<a href="http://dev.nucleuscms.org/tracker/index.php?do=details&amp;id=64">#64</a>): Applications that use the metaweblogAPI, such as Ecto can now also access and edit the extended body (rakaz)</li>
+                       <li>FIXED (<a href="http://dev.nucleuscms.org/tracker/index.php?do=details&amp;id=63">#63</a>): _getArrayVal() always returned first element of array (rakaz)</li>
                        <li>ADDED: add InitSkinParse event (rakaz)</li>
-                       <li>ADDED (<a href="http://dev.nucleuscms.org/tracker/index.php?do=details&id=38">#38</a>): added alternative output for &lt;%title%&gt;, &lt;%itemtitle%&gt;, &lt;%previtemtitle%&gt; and &lt;%nextitemtitle%&gt; (rakaz)</li>
-                       <li>FIXED (<a href="http://dev.nucleuscms.org/tracker/index.php?do=details&id=51">#51</a>): removed hardcoded charset declaration from the RSS 2 skin (rakaz)</li>
-                       <li>ADDED (<a href="http://dev.nucleuscms.org/tracker/index.php?do=details&id=55">#55</a>): add &lt;%skinvar%&gt; variable that corresponds with _CHARSET (rakaz)</li>
-                       <li>ADDED (<a href="http://dev.nucleuscms.org/tracker/index.php?do=details&id=24">#24</a>): add PostUpdateItem event (admun)</li>
-                       <li>FIXED (<a href="http://dev.nucleuscms.org/tracker/index.php?do=details&id=48">#48</a>):  &lt;%if(nextitem)%&gt; and &lt;%nextlink%&gt; didn't use the timezone offset. (<a href="http://forum.nucleuscms.org/viewtopic.php?t=6371">Basic</a>)</li>
-                       <li>FIXED: "ADMIN.php line 5270" fatal error when plugin filename and plugin classname mismtach (Frankenstein)</li>
-                       <li>CHANGED (<a href="http://dev.nucleuscms.org/tracker/index.php?do=details&id=16">#16</a>): Event <code>PreSkinItem</code> can now modify the skin contents; <code>PreComment</code> now knows the ItemID. (<a href="http://forum.nucleuscms.org/viewtopic.php?t=6266">suggested</a> by Andy)</li>
+                       <li>ADDED (<a href="http://dev.nucleuscms.org/tracker/index.php?do=details&amp;id=38">#38</a>): added alternative output for &lt;%title%&gt;, &lt;%itemtitle%&gt;, &lt;%previtemtitle%&gt; and &lt;%nextitemtitle%&gt; (rakaz)</li>
+                       <li>FIXED (<a href="http://dev.nucleuscms.org/tracker/index.php?do=details&amp;id=51">#51</a>): removed hardcoded charset declaration from the RSS 2 skin (rakaz)</li>
+                       <li>ADDED (<a href="http://dev.nucleuscms.org/tracker/index.php?do=details&amp;id=55">#55</a>): add &lt;%skinvar%&gt; variable that corresponds with _CHARSET (rakaz)</li>
+                       <li>ADDED (<a href="http://dev.nucleuscms.org/tracker/index.php?do=details&amp;id=24">#24</a>): add PostUpdateItem event (admun)</li>
+                       <li>FIXED (<a href="http://dev.nucleuscms.org/tracker/index.php?do=details&amp;id=48">#48</a>):  &lt;%if(nextitem)%&gt; and &lt;%nextlink%&gt; didn't use the timezone offset. (<a href="http://forum.nucleuscms.org/viewtopic.php?t=6371">Basic</a>)</li>
+                       <li>FIXED: "ADMIN.php line 5270" fatal error when plugin filename and plugin classname mismatch (Frankenstein)</li>
+                       <li>CHANGED (<a href="http://dev.nucleuscms.org/tracker/index.php?do=details&amp;id=16">#16</a>): Event <code>PreSkinItem</code> can now modify the skin contents; <code>PreComment</code> now knows the ItemID. (<a href="http://forum.nucleuscms.org/viewtopic.php?t=6266">suggested</a> by Andy)</li>
                </ul>
        </li>
        <li>
index 404204c..17b6c8d 100755 (executable)
@@ -1,8 +1,8 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml" lang="ja-JP" xml:lang="ja-JP">
 <head>
-       <!-- $Id: index.html,v 1.5 2006-07-12 07:11:46 kimitake Exp $ -->
-       <!-- $NucleusJP: index.html,v 1.4.2.1 2005/09/27 06:59:11 kimitake Exp $ -->
+       <!-- $Id: index.html,v 1.6 2006-07-17 20:02:50 kimitake Exp $ -->
+       <!-- $NucleusJP: index.html,v 1.5 2006/07/12 07:11:46 kimitake Exp $ -->
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <title>Nucleus CMS マニュアル</title>
        <link rel="stylesheet" type="text/css" href="styles/manual.css" />
@@ -11,7 +11,7 @@
 
 <div class="heading">
 Nucleus CMS マニュアル
-<i>(v3.22)</i>
+<i>(v3.3)</i>
 </div>
 
 <div class="note">
@@ -97,7 +97,7 @@ Nucleus はサイト構築にあたって痒いところに手が届くように
 <p>
 Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
 <br />
-Copyright (C) 2002-2005 The Nucleus Group
+Copyright (C) 2002-2006 The Nucleus Group
 </p>
 
 <p>このプログラムはフリーウェアです。フリーソフトウェア財団(the Free Software Foundation)が公表したGNU一般公共使用許諾(GNU General Public License)の「バージョン2」或いはそれ以降の各バージョンの中からいずれかを選択し、そのバージョンが定める条項に従ったうえで、本プログラムの再配布・改変を認めています。
@@ -413,4 +413,4 @@ Nucleusが今日に至るのも、また、このほかのたくさんの方々
 
 
 </body>
-</html>
+</html>
\ No newline at end of file
index 72a3171..df2b81e 100755 (executable)
@@ -1,19 +1,18 @@
 <a id="nucleus_cf"></a>
 <form method="post" action="#nucleus_cf">
-  <div class="commentform">
-       <%errordiv%>
-       
-       <input type="hidden" name="action" value="addcomment" />
-       <input type="hidden" name="url" value="<%formdata(destinationurl)%>" />
-       <input type="hidden" name="itemid" value="<%itemid%>" />
-       <label for="nucleus_cf_body"><%text(_COMMENTFORM_COMMENT)%></label>:
-       <br />
-       <textarea name="body" class="formfield" cols="40" rows="10" id="nucleus_cf_body"><%formdata(body)%></textarea>
-       <br />
-       <%text(_COMMENTFORM_YOUARE)%> <%formdata(membername)%>
-       <small>(<a href="?action=logout"><%text(_LOGOUT)%></a>)</small>
-       <br />
-       <input type="submit" value="<%text(_COMMENTFORM_SUBMIT)%>" class="formbutton" />
-       <%callback(FormExtra,commentform-loggedin)%>    
-  </div>
+<input type="hidden" name="action" value="addcomment" />
+<input type="hidden" name="url" value="<%formdata(destinationurl)%>" />
+<input type="hidden" name="itemid" value="<%itemid%>" />
+       <div class="commentform">
+               <%errordiv%>
+               <label for="nucleus_cf_body"><%text(_COMMENTFORM_COMMENT)%></label>
+               <textarea name="body" class="formfield" cols="40" rows="10" id="nucleus_cf_body"><%formdata(body)%></textarea>
+
+               <%text(_COMMENTFORM_YOUARE)%> <%formdata(membername)%>
+               <small>(<a href="<%self%>?action=logout" title="<%text(_LOGOUT)%>"><%text(_LOGOUT)%></a>)</small>
+
+               <input type="submit" alt="<%text(_COMMENTFORM_SUBMIT)%>" value="<%text(_COMMENTFORM_SUBMIT)%>" class="formbutton" />
+
+               <%callback(FormExtra,commentform-loggedin)%>
+       </div>
 </form>
\ No newline at end of file
index 7d9946d..30e525d 100755 (executable)
@@ -1,25 +1,28 @@
 <a id="nucleus_cf"></a>
-<form method="post" action="#nucleus_cf"> 
-  <div class="commentform">
+<form method="post" action="#nucleus_cf">
+<input type="hidden" name="action" value="addcomment" />
+<input type="hidden" name="url" value="<%formdata(destinationurl)%>" />
+<input type="hidden" name="itemid" value="<%itemid%>" />
+       <div class="commentform">
+               <%errordiv%>
 
-       <%errordiv%>
+               <label for="nucleus_cf_body"><%text(_COMMENTFORM_COMMENT)%></label>
+               <textarea name="body" class="formfield" cols="40" rows="10" id="nucleus_cf_body"><%formdata(body)%></textarea>
 
-       <input type="hidden" name="action" value="addcomment" />
-       <input type="hidden" name="url" value="<%formdata(destinationurl)%>" />
-       <input type="hidden" name="itemid" value="<%itemid%>" />
-       <label for="nucleus_cf_body"><%text(_COMMENTFORM_COMMENT)%></label>:
-       <br />
-       <textarea name="body" class="formfield" cols="40" rows="10" id="nucleus_cf_body"><%formdata(body)%></textarea>
-       <br />
-       <label for="nucleus_cf_name"><%text(_COMMENTFORM_NAME)%></label>: <input name="user" size="40" maxlength="40" value="<%formdata(user)%>" class="formfield" id="nucleus_cf_name" />
-       <br />
-       <label for="nucleus_cf_mail"><%text(_COMMENTFORM_MAIL)%></label>: <input name="userid" size="40" maxlength="60" value="<%formdata(userid)%>" class="formfield" id="nucleus_cf_mail" />
+               <label for="nucleus_cf_name"><%text(_COMMENTFORM_NAME)%></label>
+               <input name="user" size="40" maxlength="40" value="<%formdata(user)%>" class="formfield" id="nucleus_cf_name" />
 
-       <%callback(FormExtra,commentform-notloggedin)%> 
-       
-       <br />
-       <input type="checkbox" value="1" name="remember" id="nucleus_cf_remember" <%formdata(rememberchecked)%> /><label for="nucleus_cf_remember"><%text(_COMMENTFORM_REMEMBER)%></label>
-       <br />
-       <input type="submit" value="<%text(_COMMENTFORM_SUBMIT)%>" class="formbutton" />
-  </div>
+               <label for="nucleus_cf_mail"><%text(_COMMENTFORM_MAIL)%></label>
+               <input name="userid" size="40" maxlength="60" value="<%formdata(userid)%>" class="formfield" id="nucleus_cf_mail" />
+
+               <label for="nucleus_cf_email"><%text(_COMMENTFORM_EMAIL)%></label>
+               <input name="email" size="40" maxlength="100" value="<%formdata(email)%>" class="formfield" id="nucleus_cf_email" />
+
+               <%callback(FormExtra,commentform-notloggedin)%>
+
+               <input type="checkbox" value="1" name="remember" id="nucleus_cf_remember" <%formdata(rememberchecked)%> />
+               <label for="nucleus_cf_remember"><%text(_COMMENTFORM_REMEMBER)%></label>
+
+               <input type="submit" alt="<%text(_COMMENTFORM_SUBMIT)%>" value="<%text(_COMMENTFORM_SUBMIT)%>" class="formbutton" />
+       </div>
 </form>
\ No newline at end of file
index 28c0544..dae2336 100755 (executable)
@@ -1,4 +1,4 @@
 <a id="nucleus_lf"></a>
 <div class="loginform">
-       <%text(_LOGINFORM_YOUARE)%> <%formdata(membername)%> ! (<a href="<%self%>?action=logout"><%text(_LOGOUT)%></a>)
+       <%text(_LOGINFORM_YOUARE)%> <%formdata(membername)%> ! (<a href="<%self%>?action=logout" title="<%text(_LOGOUT)%>"><%text(_LOGOUT)%></a>)
 </div>
index a157f8c..2acbd47 100755 (executable)
@@ -1,16 +1,18 @@
 <a id="nucleus_lf"></a>
 <form method="post" action="#nucleus_lf">
-  <div class="loginform">
-  
-       <%errordiv%>
-  
-       <input type="hidden" name="action" value="login" />
-       <label for="nucleus_lf_name" accesskey="l"><%text(_LOGINFORM_NAME)%></label>: <input id="nucleus_lf_name" name="login" size="10" value="" class="formfield" />
-       <br />
-       <label for="nucleus_lf_pwd"><%text(_LOGINFORM_PWD)%></label>: <input id="nucleus_lf_pwd" name="password" size="10" type="password" value="" class="formfield" />
-       <br />
-       <input type="submit" value="<%text(_LOGIN)%>" class="formbutton" />
-       <br />
-       <input type="checkbox" value="1" name="shared" id="nucleus_lf_shared" /><label for="nucleus_lf_shared"><%text(_LOGINFORM_SHARED)%></label>
-  </div>
+<input type="hidden" name="action" value="login" />
+       <div class="loginform">
+               <%errordiv%>
+
+               <label for="nucleus_lf_name" accesskey="l"><%text(_LOGINFORM_NAME)%></label>
+               <input id="nucleus_lf_name" name="login" size="10" value="" class="formfield" />
+
+               <label for="nucleus_lf_pwd"><%text(_LOGINFORM_PWD)%></label>
+               <input id="nucleus_lf_pwd" name="password" size="10" type="password" value="" class="formfield" />
+
+               <input type="checkbox" value="1" name="shared" id="nucleus_lf_shared" />
+               <label for="nucleus_lf_shared"><%text(_LOGINFORM_SHARED)%></label>
+
+               <input type="submit" alt="<%text(_LOGIN)%>" value="<%text(_LOGIN)%>" class="formbutton" />
+       </div>
 </form>
\ No newline at end of file
index a814712..f0b3cd1 100755 (executable)
@@ -1,19 +1,15 @@
 <a id="nucleus_mf"></a>
 <form method="post" action="#nucleus_mf">
-  <div class="mailform">
-       <%errordiv%>
-  
-       <input type="hidden" name="memberid" value="<%formdata(memberid)%>" />
-       <input type="hidden" name="action" value="sendmessage" />
+<input type="hidden" name="memberid" value="<%formdata(memberid)%>" />
+<input type="hidden" name="action" value="sendmessage" />
+<input type="hidden" name="url" value="<%formdata(url)%>" />
+       <div class="mailform">
+               <%errordiv%>
 
-       <input type="hidden" name="url" value="<%formdata(url)%>" />
+               <textarea alt="<%text(_MMAIL_MAIL)%>" name="message" class="formfield" rows="<%formdata(rows)%>" cols="<%formdata(cols)%>"><%formdata(message)%></textarea>
 
-       <textarea name="message" class="formfield" rows="<%formdata(rows)%>" cols="<%formdata(cols)%>"><%formdata(message)%></textarea>
+               <%callback(FormExtra,membermailform-loggedin)%>
 
-       <%callback(FormExtra,membermailform-loggedin)%> 
-       
-       <br />
-       <input type="submit" value="<%text(_MEMBERMAIL_SUBMIT)%>" class="formbutton" />
-       
-  </div>
-</form>                
+               <input type="submit" alt="<%text(_MEMBERMAIL_SUBMIT)%>" value="<%text(_MEMBERMAIL_SUBMIT)%>" class="formbutton" />
+       </div>
+</form>
index 810a49f..7e66c98 100755 (executable)
@@ -1,20 +1,18 @@
 <a id="nucleus_mf"></a>
 <form method="post" action="#nucleus_mf">
-  <div class="mailform">
-       <%errordiv%>
-       
-       <input type="hidden" name="memberid" value="<%formdata(memberid)%>" />
-       <input type="hidden" name="action" value="sendmessage" />
+<input type="hidden" name="memberid" value="<%formdata(memberid)%>" />
+<input type="hidden" name="action" value="sendmessage" />
+<input type="hidden" name="url" value="<%formdata(url)%>" />
+       <div class="mailform">
+               <%errordiv%>
 
-       <input type="hidden" name="url" value="<%formdata(url)%>" />
+               <textarea alt="<%text(_MMAIL_MAIL)%>" name="message" class="formfield" rows="<%formdata(rows)%>" cols="<%formdata(cols)%>"><%formdata(message)%></textarea>
 
-       <textarea name="message" class="formfield" rows="<%formdata(rows)%>" cols="<%formdata(cols)%>"><%formdata(message)%></textarea>
-       <br />
-       <%text(_MEMBERMAIL_MAIL)%><input type="text" name="frommail" class="formfield" value="<%formdata(frommail)%>" />
-       
-       <%callback(FormExtra,membermailform-notloggedin)%>      
-       
-       <br />
-       <input type="submit" value="<%text(_MEMBERMAIL_SUBMIT)%>" class="formbutton" />
-  </div>
-</form>                
+               <label for="nucleus_mmf_frommail"><%text(_MEMBERMAIL_MAIL)%></label>
+               <input id="nucleus_mmf_frommail" type="text" name="frommail" class="formfield" value="<%formdata(frommail)%>" />
+
+               <%callback(FormExtra,membermailform-notloggedin)%>
+
+               <input type="submit" alt="<%text(_MEMBERMAIL_SUBMIT)%>" value="<%text(_MEMBERMAIL_SUBMIT)%>" class="formbutton" />
+       </div>
+</form>
index a283175..64f545f 100755 (executable)
@@ -1,3 +1,3 @@
 <div class="nucleusbutton">
-<a href="http://nucleuscms.org/"><img src="<%formdata(imgurl)%>" width="<%formdata(imgwidth)%>" height="<%formdata(imgheight)%>" alt="Powered by Nucleus CMS" /></a>
+       <a href="http://nucleuscms.org/"><img src="<%formdata(imgurl)%>" width="<%formdata(imgwidth)%>" height="<%formdata(imgheight)%>" alt="Powered by Nucleus CMS" title="Powered by Nucleus CMS" /></a>
 </div>
index a63ce9f..d423e9e 100755 (executable)
@@ -1,9 +1,8 @@
 <form method="get" action="<%self%>">
-  <div class="searchform">
-       <input name="query" class="formfield" size="10" maxlength="60" accesskey="4" value="<%formdata(query)%>" />
-       <input type="hidden" name="amount" value="0" />
-       <input type="hidden" name="blogid" value="<%formdata(id)%>" />
-       <br />
-       <input type="submit" value="<%text(_SEARCHFORM_SUBMIT)%>" class="formbutton" />
-  </div>
+<input type="hidden" name="amount" value="0" />
+<input type="hidden" name="blogid" value="<%formdata(id)%>" />
+       <div class="searchform">
+               <input name="query" alt="<%text(_SEARCHFORM_QUERY)%>" class="formfield" size="10" maxlength="60" accesskey="4" value="<%formdata(query)%>" />
+               <input type="submit" alt="<%text(_SEARCHFORM_SUBMIT)%>" value="<%text(_SEARCHFORM_SUBMIT)%>" class="formbutton" />
+       </div>
 </form>
index 5d7bbeb..13724a8 100755 (executable)
@@ -2,7 +2,7 @@
 
 /*
  * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
- * Copyright (C) 2002-2005 The Nucleus Group
+ * Copyright (C) 2002-2006 The Nucleus Group
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
  * Actions that can be called via action.php
  *
  * @license http://nucleuscms.org/license.txt GNU General Public License
- * @copyright Copyright (C) 2002-2005 The Nucleus Group
- * @version $Id: ACTION.php,v 1.4 2006-07-12 07:11:47 kimitake Exp $
- * $NucleusJP: ACTION.php,v 1.3 2005/08/13 07:30:01 kimitake Exp $
+ * @copyright Copyright (C) 2002-2006 The Nucleus Group
+ * @version $Id: ACTION.php,v 1.5 2006-07-17 20:03:44 kimitake Exp $
+ * $NucleusJP: ACTION.php,v 1.4 2006/07/12 07:11:47 kimitake Exp $
  */
 class ACTION
 {
        function ACTION()
        {
-       
+
        }
-       
-       function doAction($action) 
+
+       function doAction($action)
        {
                switch($action) {
+                       case 'autodraft':
+                               return $this->autoDraft();
+                               break;
+                       case 'updateticket':
+                               return $this->updateTicket();
+                               break;
                        case 'addcomment':
                                return $this->addComment();
                                break;
@@ -36,7 +42,7 @@ class ACTION
                                break;
                        case 'createaccount':
                                return $this->createAccount();
-                               break;          
+                               break;
                        case 'forgotpassword':
                                return $this->forgotPassword();
                                break;
@@ -53,13 +59,14 @@ class ACTION
                                doError(_ERROR_BADACTION);
                }
        }
-       
+
        function addComment() {
                global $CONF, $errormessage, $manager;
 
                $post['itemid'] =       intPostVar('itemid');
                $post['user'] =         postVar('user');
                $post['userid'] =       postVar('userid');
+               $post['email'] =   postVar('email');
                $post['body'] =         postVar('body');
 
                // set cookies when required
@@ -68,6 +75,7 @@ class ACTION
                        $lifetime = time()+2592000;
                        setcookie($CONF['CookiePrefix'] . 'comment_user',$post['user'],$lifetime,'/','',0);
                        setcookie($CONF['CookiePrefix'] . 'comment_userid', $post['userid'],$lifetime,'/','',0);
+                       setcookie($CONF['CookiePrefix'] . 'comment_email',  $post['email'], $lifetime,'/','',0);
                }
 
                $comments = new COMMENTS($post['itemid']);
@@ -79,7 +87,7 @@ class ACTION
                // note: PreAddComment and PostAddComment gets called somewhere inside addComment
                $errormessage = $comments->addComment($blog->getCorrectTime(),$post);
 
-               if ($errormessage == '1') {             
+               if ($errormessage == '1') {
                        // redirect when adding comments succeeded
                        if (postVar('url')) {
                                redirect(postVar('url'));
@@ -94,7 +102,7 @@ class ACTION
                                'skinid' => $blog->getDefaultSkin()
                        );
                }
-               
+
                exit;
        }
 
@@ -142,15 +150,15 @@ class ACTION
                        }
                        redirect($url);
                }
-               
+
                exit;
 
        }
-       
+
        function validateMessage() {
                global $CONF, $member, $manager;
 
-               if (!$CONF['AllowMemberMail']) 
+               if (!$CONF['AllowMemberMail'])
                        return _ERROR_MEMBERMAILDISABLED;
 
                if (!$member->isLoggedIn() && !$CONF['NonmemberMail'])
@@ -158,21 +166,21 @@ class ACTION
 
                if (!$member->isLoggedIn() && (!isValidMailAddress(postVar('frommail'))))
                        return _ERROR_BADMAILADDRESS;
-                       
+
                // let plugins do verification (any plugin which thinks the comment is invalid
                // can change 'error' to something other than '')
                $result = '';
                $manager->notify('ValidateForm', array('type' => 'membermail', 'error' => &$result));
-               
+
                return $result;
-               
+
        }
 
        // creates a new user account
        function createAccount() {
                global $CONF, $manager;
 
-               if (!$CONF['AllowMemberCreate']) 
+               if (!$CONF['AllowMemberCreate'])
                        doError(_ERROR_MEMBERCREATEDISABLED);
 
                // even though the member can not log in, set some random initial password. One never knows.
@@ -181,16 +189,16 @@ class ACTION
 
                // create member (non admin/can not login/no notes/random string as password)
                $r = MEMBER::create(postVar('name'), postVar('realname'), $initialPwd, postVar('email'), postVar('url'), 0, 0, '');
-               
+
                if ($r != 1)
                        doError($r);
-                       
+
                // send message containing password.
                $newmem = new MEMBER();
                $newmem->readFromName(postVar('name'));
                $newmem->sendActivationLink('register');
 
-               $manager->notify('PostRegister',array('member' => &$newmem));           
+               $manager->notify('PostRegister',array('member' => &$newmem));
 
                if (postVar('desturl')) {
                        redirect(postVar('desturl'));
@@ -198,11 +206,11 @@ class ACTION
                        header ("Content-Type: text/html; charset="._CHARSET);
                        echo _MSG_ACTIVATION_SENT;
                }
-               
+
                exit;
        }
 
-       // sends a new password 
+       // sends a new password
        function forgotPassword() {
                $membername = trim(postVar('name'));
 
@@ -223,10 +231,9 @@ class ACTION
                if (postVar('url')) {
                        redirect(postVar('url'));
                } else {
-                       header ("Content-Type: text/html; charset="._CHARSET);
                        echo _MSG_ACTIVATION_SENT;
                }
-               
+
                exit;
        }
 
@@ -235,17 +242,17 @@ class ACTION
                global $itemid, $member, $CONF, $manager;
 
                // check if itemid exists
-               if (!$manager->existsItem($itemid,0,0)) 
+               if (!$manager->existsItem($itemid,0,0))
                        doError(_ERROR_NOSUCHITEM);
 
                $blogid = getBlogIDFromItemID($itemid);
-               $this->checkban($blogid);       
+               $this->checkban($blogid);
 
                $karma =& $manager->getKarma($itemid);
 
                // check if not already voted
-               if (!$karma->isVoteAllowed(serverVar('REMOTE_ADDR'))) 
-                       doError(_ERROR_VOTEDBEFORE);            
+               if (!$karma->isVoteAllowed(serverVar('REMOTE_ADDR')))
+                       doError(_ERROR_VOTEDBEFORE);
 
                // check if item does allow voting
                $item =& $manager->getItem($itemid,0,0);
@@ -253,7 +260,7 @@ class ACTION
                        doError(_ERROR_ITEMCLOSED);
 
                switch($type) {
-                       case 'pos': 
+                       case 'pos':
                                $karma->votePositive();
                                break;
                        case 'neg':
@@ -292,7 +299,7 @@ class ACTION
                else
                        $url = $CONF['IndexURL'] . 'index.php?itemid=' . $itemid;
 
-               redirect($url); 
+               redirect($url);
                exit;
        }
 
@@ -321,7 +328,7 @@ class ACTION
                // - no actions are allowed (doAction is not implemented)
                if ($error)
                        doError($error);
-                       
+
                exit;
 
        }
@@ -335,7 +342,42 @@ class ACTION
 
        }
 
+       /**
+        * Gets a new ticket
+        */
+       function updateTicket() {
+               global $manager;
+               if ($manager->checkTicket()) {
+                       echo $manager->getNewTicket();
+               }
+               else {
+                       echo 'err:' . _ERROR_BADTICKET;
+               }
+               return false;
+       }
+
+       /**
+        * Handles AutoSaveDraft
+        */
+       function autoDraft() {
+               global $manager;
+               if ($manager->checkTicket()) {
+                       $manager->loadClass('ITEM');
+                       $info = ITEM::CreateDraftFromRequest();
+                       if ($info['status'] == 'error') {
+                               echo $info['message'];
+                       }
+                       else {
+                               echo $info['draftid'];
+                       }
+               }
+               else {
+                       echo 'err:' . _ERROR_BADTICKET;
+               }
+               return false;
+       }
+
 
 }
 
-?>
+?>
\ No newline at end of file
index b5bc6ca..2737137 100755 (executable)
@@ -1,85 +1,85 @@
-<?php\r
-/*\r
- * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
- * Copyright (C) 2002-2005 The Nucleus Group\r
- *\r
- * This program is free software; you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License\r
- * as published by the Free Software Foundation; either version 2\r
- * of the License, or (at your option) any later version.\r
- * (see nucleus/documentation/index.html#license for more info)\r
- */\r
-/**\r
- * Actionlog class for Nucleus\r
- *\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.4 2005-08-13 07:31:04 kimitake Exp $\r
- * $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
-define('INFO',3);              // info, errors and warnings\r
-define('DEBUG',4);             // everything \r
-$CONF['LogLevel'] = INFO;\r
-\r
-class ACTIONLOG {\r
-\r
-       /**\r
-         * (Static) Method to add message to log\r
-         */\r
-       function add($level, $message) {\r
-               global $member, $CONF;\r
-               \r
-               if ($CONF['LogLevel'] < $level)\r
-                       return;\r
-               \r
-               if ($member && $member->isLoggedIn())\r
-                       $message = "[" . $member->getDisplayName() . "] " . $message;\r
-               \r
-               $message = addslashes($message);                // add slashes\r
-               $timestamp = date("Y-m-d H:i:s",time());        // format timestamp\r
-               $query = "INSERT INTO " . sql_table('actionlog') . " (timestamp, message) VALUES ('$timestamp', '$message')";\r
-               \r
-               sql_query($query);\r
-               \r
-               ACTIONLOG::trimLog();\r
-       }\r
-       \r
-       /**\r
-         * (Static) Method to clear log\r
-         */\r
-       function clear() {\r
-               global $manager;\r
-               \r
-               $query = 'DELETE FROM ' . sql_table('actionlog');\r
-\r
-               $manager->notify('ActionLogCleared',array());\r
-               \r
-               return sql_query($query);\r
-       }\r
-       \r
-       function trimLog() {\r
-               static $checked = 0;\r
-               \r
-               // only check once per run\r
-               if ($checked) return;\r
-               \r
-               // trim\r
-               $checked = 1;\r
-               \r
-               $iTotal = quickQuery('SELECT COUNT(*) AS result FROM ' . sql_table('actionlog'));\r
-               \r
-               // if size > 500, drop back to about 250\r
-               $iMaxSize = 500;\r
-               $iDropSize = 250;\r
-               if ($iTotal > $iMaxSize) {\r
-                       $tsChop = quickQuery('SELECT timestamp as result FROM ' . sql_table('actionlog') . ' ORDER BY timestamp DESC LIMIT '.$iDropSize.',1');\r
-                       sql_query('DELETE FROM ' . sql_table('actionlog') . ' WHERE timestamp < \'' . $tsChop . '\'');\r
-               }\r
-               \r
-       }\r
-\r
-}\r
-\r
-?>\r
+<?php
+/*
+ * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
+ * Copyright (C) 2002-2006 The Nucleus Group
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * (see nucleus/documentation/index.html#license for more info)
+ */
+/**
+ * Actionlog class for Nucleus
+ *
+ * @license http://nucleuscms.org/license.txt GNU General Public License
+ * @copyright Copyright (C) 2002-2006 The Nucleus Group
+ * @version $Id: ACTIONLOG.php,v 1.5 2006-07-17 20:03:44 kimitake Exp $
+ * $NucleusJP: ACTIONLOG.php,v 1.4 2005/08/13 07:31:04 kimitake Exp $
+ */
+define('ERROR',1);             // only errors
+define('WARNING',2);   // errors and warnings
+define('INFO',3);              // info, errors and warnings
+define('DEBUG',4);             // everything
+$CONF['LogLevel'] = INFO;
+
+class ACTIONLOG {
+
+       /**
+         * (Static) Method to add message to log
+         */
+       function add($level, $message) {
+               global $member, $CONF;
+
+               if ($CONF['LogLevel'] < $level)
+                       return;
+
+               if ($member && $member->isLoggedIn())
+                       $message = "[" . $member->getDisplayName() . "] " . $message;
+
+               $message = addslashes($message);                // add slashes
+               $timestamp = date("Y-m-d H:i:s",time());        // format timestamp
+               $query = "INSERT INTO " . sql_table('actionlog') . " (timestamp, message) VALUES ('$timestamp', '$message')";
+
+               sql_query($query);
+
+               ACTIONLOG::trimLog();
+       }
+
+       /**
+         * (Static) Method to clear log
+         */
+       function clear() {
+               global $manager;
+
+               $query = 'DELETE FROM ' . sql_table('actionlog');
+
+               $manager->notify('ActionLogCleared',array());
+
+               return sql_query($query);
+       }
+
+       function trimLog() {
+               static $checked = 0;
+
+               // only check once per run
+               if ($checked) return;
+
+               // trim
+               $checked = 1;
+
+               $iTotal = quickQuery('SELECT COUNT(*) AS result FROM ' . sql_table('actionlog'));
+
+               // if size > 500, drop back to about 250
+               $iMaxSize = 500;
+               $iDropSize = 250;
+               if ($iTotal > $iMaxSize) {
+                       $tsChop = quickQuery('SELECT timestamp as result FROM ' . sql_table('actionlog') . ' ORDER BY timestamp DESC LIMIT '.$iDropSize.',1');
+                       sql_query('DELETE FROM ' . sql_table('actionlog') . ' WHERE timestamp < \'' . $tsChop . '\'');
+               }
+
+       }
+
+}
+
+?>
\ No newline at end of file
index 5f23012..2946670 100755 (executable)
-<?php\r
-/*\r
- * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
- * Copyright (C) 2002-2005 The Nucleus Group\r
- *\r
- * This program is free software; you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License\r
- * as published by the Free Software Foundation; either version 2\r
- * of the License, or (at your option) any later version.\r
- * (see nucleus/documentation/index.html#license for more info)\r
- */\r
-/**\r
- * PHP class responsible for ban-management.\r
- *\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.4 2005-08-13 07:31:04 kimitake Exp $\r
-  * $NucleusJP: BAN.php,v 1.3 2005/03/12 06:19:05 kimitake Exp $\r
- */\r
-  \r
-class BAN {\r
-       \r
-       /**\r
-         * Checks if a given IP is banned from commenting/voting\r
-         *\r
-         * Returns 0 when not banned, or a BANINFO object containing the\r
-         * message and other information of the ban\r
-         */\r
-       function isBanned($blogid, $ip) {\r
-               $blogid = intval($blogid);\r
-               $query = 'SELECT * FROM '.sql_table('ban').' WHERE blogid='.$blogid;\r
-               $res = sql_query($query);\r
-               while ($obj = mysql_fetch_object($res)) {\r
-                       $found = strpos ($ip, $obj->iprange);\r
-                       if (!($found === false)) \r
-                               // found a match!\r
-                               return new BANINFO($obj->iprange, $obj->reason);\r
-               }\r
-               return 0;\r
-       }\r
-       \r
-       /**\r
-         * Adds a new ban to the banlist. Returns 1 on success, 0 on error\r
-         */\r
-       function addBan($blogid, $iprange, $reason) {\r
-               global $manager;\r
-               \r
-               $blogid = intval($blogid);\r
-       \r
-               $manager->notify(\r
-                       'PreAddBan',\r
-                       array(\r
-                               'blogid' => $blogid,\r
-                               'iprange' => &$iprange,\r
-                               'reason' => &$reason\r
-                       )\r
-               );\r
-       \r
-               $query = 'INSERT INTO '.sql_table('ban')." (blogid, iprange, reason) VALUES "\r
-                      . "($blogid,'".addslashes($iprange)."','".addslashes($reason)."')";\r
-               $res = sql_query($query);\r
-               \r
-               $manager->notify(\r
-                       'PostAddBan',\r
-                       array(\r
-                               'blogid' => $blogid,\r
-                               'iprange' => $iprange,\r
-                               'reason' => $reason\r
-                       )\r
-               );\r
-               \r
-               return $res ? 1 : 0;\r
-       }\r
-       \r
-       /**\r
-         * Removes a ban from the banlist (correct iprange is needed as argument)\r
-         * Returns 1 on success, 0 on error\r
-         */\r
-       function removeBan($blogid, $iprange) {\r
-               global $manager;\r
-               $blogid = intval($blogid);\r
-               \r
-               $manager->notify('PreDeleteBan', array('blogid' => $blogid, 'range' => $iprange));\r
-               \r
-               $query = 'DELETE FROM '.sql_table('ban')." WHERE blogid=$blogid and iprange='" .addslashes($iprange). "'";\r
-               sql_query($query);\r
-               \r
-               $result = (mysql_affected_rows() > 0);\r
-               \r
-               $manager->notify('PostDeleteBan', array('blogid' => $blogid, 'range' => $iprange));\r
-               \r
-               return $result;\r
-       }\r
-}\r
-\r
-class BANINFO {\r
-       var $iprange;\r
-       var $message;\r
-       \r
-       function BANINFO($iprange, $message) {\r
-               $this->iprange = $iprange;\r
-               $this->message = $message;\r
-       }\r
-}\r
-\r
-\r
-?>\r
+<?php
+/*
+ * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
+ * Copyright (C) 2002-2006 The Nucleus Group
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * (see nucleus/documentation/index.html#license for more info)
+ */
+/**
+ * PHP class responsible for ban-management.
+ *
+ * @license http://nucleuscms.org/license.txt GNU General Public License
+ * @copyright Copyright (C) 2002-2006 The Nucleus Group
+ * @version $Id: BAN.php,v 1.5 2006-07-17 20:03:44 kimitake Exp $
+  * $NucleusJP: BAN.php,v 1.4 2005/08/13 07:31:04 kimitake Exp $
+ */
+
+class BAN {
+
+       /**
+         * Checks if a given IP is banned from commenting/voting
+         *
+         * Returns 0 when not banned, or a BANINFO object containing the
+         * message and other information of the ban
+         */
+       function isBanned($blogid, $ip) {
+               $blogid = intval($blogid);
+               $query = 'SELECT * FROM '.sql_table('ban').' WHERE blogid='.$blogid;
+               $res = sql_query($query);
+               while ($obj = mysql_fetch_object($res)) {
+                       $found = strpos ($ip, $obj->iprange);
+                       if (!($found === false))
+                               // found a match!
+                                       return new BANINFO($obj->iprange, $obj->reason);
+               }
+               return 0;
+       }
+
+       /**
+         * Adds a new ban to the banlist. Returns 1 on success, 0 on error
+         */
+       function addBan($blogid, $iprange, $reason) {
+               global $manager;
+
+               $blogid = intval($blogid);
+
+               $manager->notify(
+                       'PreAddBan',
+                       array(
+                               'blogid' => $blogid,
+                               'iprange' => &$iprange,
+                               'reason' => &$reason
+                       )
+               );
+
+               $query = 'INSERT INTO '.sql_table('ban')." (blogid, iprange, reason) VALUES "
+                          . "($blogid,'".addslashes($iprange)."','".addslashes($reason)."')";
+               $res = sql_query($query);
+
+               $manager->notify(
+                       'PostAddBan',
+                       array(
+                               'blogid' => $blogid,
+                               'iprange' => $iprange,
+                               'reason' => $reason
+                       )
+               );
+
+               return $res ? 1 : 0;
+       }
+
+       /**
+         * Removes a ban from the banlist (correct iprange is needed as argument)
+         * Returns 1 on success, 0 on error
+         */
+       function removeBan($blogid, $iprange) {
+               global $manager;
+               $blogid = intval($blogid);
+
+               $manager->notify('PreDeleteBan', array('blogid' => $blogid, 'range' => $iprange));
+
+               $query = 'DELETE FROM '.sql_table('ban')." WHERE blogid=$blogid and iprange='" .addslashes($iprange). "'";
+               sql_query($query);
+
+               $result = (mysql_affected_rows() > 0);
+
+               $manager->notify('PostDeleteBan', array('blogid' => $blogid, 'range' => $iprange));
+
+               return $result;
+       }
+}
+
+class BANINFO {
+       var $iprange;
+       var $message;
+
+       function BANINFO($iprange, $message) {
+               $this->iprange = $iprange;
+               $this->message = $message;
+       }
+}
+
+
+?>
\ No newline at end of file
index d4e401c..3b9b7bd 100755 (executable)
-<?php\r
-\r
-/*\r
- * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
- * Copyright (C) 2002-2005 The Nucleus Group\r
- *\r
- * This program is free software; you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License\r
- * as published by the Free Software Foundation; either version 2\r
- * of the License, or (at your option) any later version.\r
- * (see nucleus/documentation/index.html#license for more info)\r
- */\r
-/**\r
- * A class representing a blog and containing functions to get that blog shown\r
- * on the screen\r
- *\r
- * @license http://nucleuscms.org/license.txt GNU General Public License\r
- * @copyright Copyright (C) 2002-2005 The Nucleus Group\r
- * @version $Id: BLOG.php,v 1.4 2005-08-13 07:31:04 kimitake Exp $\r
- * $NucleusJP: BLOG.php,v 1.3 2005/03/12 06:19:05 kimitake Exp $\r
- */\r
-class BLOG {\r
-       \r
-       // blog id\r
-       var $blogid;\r
-       \r
-       // ID of currently selected category\r
-       var $selectedcatid;\r
-       \r
-       // After creating an object of the blog class, contains true if the BLOG object is \r
-       // valid (the blog exists)\r
-       var $isValid;\r
-       \r
-       // associative array, containing all blogsettings (use the get/set functions instead)\r
-       var $settings;\r
-       \r
-       /**\r
-        * Creates a new BLOG object for the given blog\r
-        *\r
-        * @param $id blogid\r
-        */\r
-       function BLOG($id) {\r
-               $this->blogid = intval($id);\r
-               $this->readSettings();\r
-\r
-               // try to set catid \r
-               // (the parse functions in SKIN.php will override this, so it's mainly useless)\r
-               global $catid;\r
-               $this->setSelectedCategory($catid);\r
-       }\r
-\r
-       /**\r
-        * Shows the given amount of items for this blog\r
-        *\r
-        * @param $template\r
-        *              String representing the template _NAME_ (!)\r
-        * @param $amountEntries \r
-        *              amount of entries to show\r
-        * @param $startpos\r
-        *              offset from where items should be shown (e.g. 5 = start at fifth item)\r
-        * @returns int\r
-        *              amount of items shown\r
-        */\r
-       function readLog($template, $amountEntries, $offset = 0, $startpos = 0) {\r
-               return $this->readLogAmount($template,$amountEntries,'','',1,1,$offset, $startpos);\r
-       }\r
-\r
-       /**\r
-        * Shows an archive for a given month\r
-        *\r
-        * @param $year\r
-        *              year\r
-        * @param $month\r
-        *              month \r
-        * @param $template\r
-        *              String representing the template name to be used\r
-        */\r
-       function showArchive($templatename, $year, $month, $day=0) {\r
-               \r
-               // create extra where clause for select query\r
-               if ($day == 0) {\r
-                       $timestamp_start = mktime(0,0,0,$month,1,$year);\r
-                       $timestamp_end = mktime(0,0,0,$month+1,1,$year);  // also works when $month==12\r
-               } else {\r
-                       $timestamp_start = mktime(0,0,0,$month,$day,$year);\r
-                       $timestamp_end = mktime(0,0,0,$month,$day+1,$year);  \r
-               }\r
-               $extra_query = ' and i.itime>=' . mysqldate($timestamp_start)\r
-                            . ' and i.itime<' . mysqldate($timestamp_end);\r
-               \r
-       \r
-               $this->readLogAmount($templatename,0,$extra_query,'',1,1);\r
-\r
-       }\r
-\r
-\r
-       // sets/gets current category (only when category exists)\r
-       function setSelectedCategory($catid) {\r
-               if ($this->isValidCategory($catid) || (intval($catid) == 0)) \r
-                       $this->selectedcatid = intval($catid);\r
-       }\r
-       \r
-       function setSelectedCategoryByName($catname) {\r
-               $this->setSelectedCategory($this->getCategoryIdFromName($catname));\r
-       }\r
-\r
-       function getSelectedCategory() { \r
-               return $this->selectedcatid; \r
-       }\r
-\r
-       /**\r
-        * Shows the given amount of items for this blog\r
-        *\r
-        * @param $template\r
-        *              String representing the template _NAME_ (!)\r
-        * @param $amountEntries\r
-        *              amount of entries to show (0 = no limit)\r
-        * @param $extraQuery\r
-        *              extra conditions to be added to the query\r
-        * @param $highlight\r
-        *              contains a query that should be highlighted\r
-        * @param $comments\r
-        *              1=show comments 0=don't show comments\r
-        * @param $dateheads\r
-        *              1=show dateheads 0=don't show dateheads\r
-        * @param $offset\r
-        *              offset\r
-        * @returns int\r
-        *              amount of items shown\r
-        */\r
-       function readLogAmount($template, $amountEntries, $extraQuery, $highlight, $comments, $dateheads, $offset = 0, $startpos = 0) {\r
-\r
-               $query = $this->getSqlBlog($extraQuery);\r
-               \r
-               if ($amountEntries > 0) {\r
-                       // $offset zou moeten worden:\r
-                       // (($startpos / $amountentries) + 1) * $offset ... later testen ...\r
-                      $query .= ' LIMIT ' . intval($startpos + $offset).',' . intval($amountEntries);\r
-               }\r
-               return $this->showUsingQuery($template, $query, $highlight, $comments, $dateheads);\r
-       }\r
-\r
-       function showUsingQuery($templateName, $query, $highlight = '', $comments = 0, $dateheads = 1) {\r
-               global $CONF, $manager;\r
-\r
-               $lastVisit = cookieVar($CONF['CookiePrefix'] .'lastVisit');\r
-               if ($lastVisit != 0)\r
-                       $lastVisit = $this->getCorrectTime($lastVisit);\r
-\r
-               // set templatename as global variable (so plugins can access it)\r
-               global $currentTemplateName;\r
-               $currentTemplateName = $templateName;\r
-               \r
-               $template =& $manager->getTemplate($templateName);\r
-               \r
-               // create parser object & action handler\r
-               $actions =& new ITEMACTIONS($this);\r
-               $parser =& new PARSER($actions->getDefinedActions(),$actions);\r
-               $actions->setTemplate($template);\r
-               $actions->setHighlight($highlight);\r
-               $actions->setLastVisit($lastVisit);\r
-               $actions->setParser($parser);\r
-               $actions->setShowComments($comments);\r
-\r
-               // execute query\r
-               $items = sql_query($query);\r
-               \r
-               // loop over all items\r
-               while ($item = mysql_fetch_object($items)) {\r
-                       \r
-                       $item->timestamp = strtotime($item->itime);     // string timestamp -> unix timestamp\r
-               \r
-                       // action handler needs to know the item we're handling\r
-                       $actions->setCurrentItem($item);\r
-                       \r
-                       // add date header if needed\r
-                       if ($dateheads) {\r
-                               $new_date = date('dFY',$item->timestamp);\r
-                               if ($new_date != $old_date) {\r
-                                       // unless this is the first time, write date footer\r
-                                       $timestamp = $item->timestamp;\r
-                                       if ($old_date != 0) {\r
-                                               $oldTS = strtotime($old_date);\r
-                                               $manager->notify('PreDateFoot',array('blog' => &$this, 'timestamp' => $oldTS));\r
-                                               $parser->parse(strftime($template['DATE_FOOTER'], $oldTS));\r
-                                               $manager->notify('PostDateFoot',array('blog' => &$this, 'timestamp' => $oldTS));                                                \r
-                                       }\r
-                                       $manager->notify('PreDateHead',array('blog' => &$this, 'timestamp' => $timestamp));\r
-                                       // note, to use templatvars in the dateheader, the %-characters need to be doubled in\r
-                                       // order to be preserved by strftime\r
-                                       $parser->parse(strftime($template['DATE_HEADER'],$timestamp));\r
-                                       $manager->notify('PostDateHead',array('blog' => &$this, 'timestamp' => $timestamp));                                    \r
-                               }\r
-                               $old_date = $new_date;\r
-                       }\r
-                       \r
-                       // parse item \r
-                       $parser->parse($template['ITEM_HEADER']);\r
-                       $manager->notify('PreItem', array('blog' => &$this, 'item' => &$item));                 \r
-                       $parser->parse($template['ITEM']);                      \r
-                       $manager->notify('PostItem', array('blog' => &$this, 'item' => &$item));                        \r
-                       $parser->parse($template['ITEM_FOOTER']);\r
-\r
-               }\r
-               \r
-               $numrows = mysql_num_rows($items);\r
-               \r
-               // add another date footer if there was at least one item\r
-               if (($numrows > 0) && $dateheads) {\r
-                       $manager->notify('PreDateFoot',array('blog' => &$this, 'timestamp' => strtotime($old_date)));           \r
-                       $parser->parse($template['DATE_FOOTER']);\r
-                       $manager->notify('PostDateFoot',array('blog' => &$this, 'timestamp' => strtotime($old_date)));\r
-               }\r
-               \r
-               mysql_free_result($items);      // free memory\r
-               \r
-               return $numrows;\r
-               \r
-       }        \r
-       \r
-       function showOneitem($itemid, $template, $highlight) {\r
-               $extraQuery = ' and inumber=' . intval($itemid);\r
-               \r
-               return $this->readLogAmount($template, 1, $extraQuery, $highlight, 0, 0);\r
-       }\r
-       \r
-\r
-       /**\r
-         * Adds an item to this blog\r
-         */\r
-       function additem($catid, $title, $body, $more, $blogid, $authorid, $timestamp, $closed, $draft) {\r
-               global $manager;\r
-\r
-               $blogid         = intval($blogid);\r
-               $authorid       = intval($authorid);\r
-               $title          = $title;\r
-               $body           = $body;\r
-               $more           = $more;\r
-               $catid          = intval($catid);\r
-\r
-               // convert newlines to <br />\r
-               if ($this->convertBreaks()) {\r
-                       $body = addBreaks($body);\r
-                       $more = addBreaks($more);\r
-               }\r
-               \r
-               if ($closed != '1')     $closed = '0';\r
-               if ($draft != '0') $draft = '1';\r
-\r
-               if (!$this->isValidCategory($catid))\r
-                       $catid = $this->getDefaultCategory();\r
-               \r
-               if ($timestamp > $this->getCorrectTime())\r
-                       $isFuture = 1;\r
-\r
-               $timestamp = date('Y-m-d H:i:s',$timestamp);\r
-\r
-               $manager->notify('PreAddItem',array('title' => &$title, 'body' => &$body, 'more' => &$more, 'blog' => &$this, 'authorid' => &$authorid, 'timestamp' => &$timestamp, 'closed' => &$closed, 'draft' => &$draft, 'catid' => &$catid));\r
-\r
-               $title = addslashes($title);\r
-               $body = addslashes($body);\r
-               $more = addslashes($more);\r
-\r
-               $query = 'INSERT INTO '.sql_table('item').' (ITITLE, IBODY, IMORE, IBLOG, IAUTHOR, ITIME, ICLOSED, IDRAFT, ICAT) '\r
-                      . "VALUES ('$title', '$body', '$more', $blogid, $authorid, '$timestamp', $closed, $draft, $catid)";\r
-               sql_query($query);  \r
-               $itemid = mysql_insert_id();\r
-               \r
-               $manager->notify('PostAddItem',array('itemid' => $itemid));\r
-               \r
-               if (!$draft) \r
-                       $this->updateUpdateFile();\r
-               \r
-               // send notification mail\r
-               if (!$draft && !$isFuture && $this->getNotifyAddress() && $this->notifyOnNewItem()) \r
-                       $this->sendNewItemNotification($itemid, stripslashes($title), stripslashes($body));\r
-               \r
-               return $itemid;\r
-       }\r
-       \r
-       function sendNewItemNotification($itemid, $title, $body) {\r
-               global $CONF, $member;\r
-               \r
-               // create text version of html post\r
-               $ascii = toAscii($body);\r
-\r
-               $mailto_msg = _NOTIFY_NI_MSG . " \n";\r
-               $mailto_msg .= $CONF['IndexURL'] . 'index.php?itemid=' . $itemid . "\n\n";\r
-               $mailto_msg .= _NOTIFY_TITLE . ' ' . strip_tags($title) . "\n";\r
-               $mailto_msg .= _NOTIFY_CONTENTS . "\n " . $ascii . "\n";\r
-               $mailto_msg .= getMailFooter();\r
-               \r
-               $mailto_title = $this->getName() . ': ' . _NOTIFY_NI_TITLE;\r
-                       \r
-               $frommail = $member->getNotifyFromMailAddress();\r
-\r
-               $notify =& new NOTIFICATION($this->getNotifyAddress());\r
-               $notify->notify($mailto_title, $mailto_msg , $frommail);\r
-                               \r
-\r
-\r
-       }\r
-\r
-       \r
-       /**\r
-         * Creates a new category for this blog\r
-         *\r
-         * @param $catName\r
-         *             name of the new category. When empty, a name is generated automatically \r
-         *             (starting with newcat)\r
-         * @param $catDescription\r
-         *             description of the new category. Defaults to 'New Category'\r
-         *\r
-         * @returns \r
-         *             the new category-id in case of success. \r
-         *             0 on failure\r
-         */\r
-       function createNewCategory($catName = '', $catDescription = 'New category') {\r
-               global $member, $manager;\r
-\r
-               if ($member->blogAdminRights($this->getID())) {\r
-                       // generate \r
-                       if ($catName == '')\r
-                       {\r
-                               $catName = 'newcat';\r
-                               $i = 1;\r
-                               while(mysql_num_rows(sql_query('SELECT * FROM '.sql_table('category')." WHERE cname='".$catName.$i."' and cblog=".$this->getID())) > 0) \r
-                                       $i++;\r
-                               $catName = $catName . $i;\r
-                       }\r
-                       \r
-                       $manager->notify(\r
-                               'PreAddCategory',\r
-                               array(\r
-                                       'blog' => &$this,\r
-                                       'name' => &$catName,\r
-                                       'description' => $catDescription\r
-                               )\r
-                       );\r
-                       \r
-                       $query = 'INSERT INTO '.sql_table('category').' (cblog, cname, cdesc) VALUES (' . $this->getID() . ", '" . addslashes($catName) . "', '" . addslashes($catDescription) . "')";\r
-                       sql_query($query);\r
-                       $catid = mysql_insert_id();\r
-                       \r
-                       $manager->notify(\r
-                               'PostAddCategory',\r
-                               array(\r
-                                       'blog' => &$this,\r
-                                       'name' => $catName,\r
-                                       'description' => $catDescription,\r
-                                       'catid' => $catid\r
-                               )\r
-                       );                      \r
-                       \r
-                       return $catid;\r
-               } else {\r
-                       return 0;\r
-               }\r
-       \r
-       }       \r
-\r
-\r
-       /**\r
-        * Searches all months of this blog for the given query\r
-        *\r
-        * @param $query\r
-        *              search query\r
-        * @param $template\r
-        *              template to be used (__NAME__ of the template)\r
-        * @param $amountMonths\r
-        *              max amount of months to be search (0 = all)\r
-        * @param $maxresults\r
-        *              max number of results to show\r
-        * @param $startpos\r
-        *              offset\r
-        * @returns\r
-        *              amount of hits found\r
-        */\r
-       function search($query, $template, $amountMonths, $maxresults, $startpos) {\r
-        global $CONF, $manager;\r
-\r
-               $highlight      = '';\r
-               $sqlquery       = $this->getSqlSearch($query, $amountMonths, $highlight);\r
-               \r
-               if ($sqlquery == '')\r
-               {\r
-                       // no query -> show everything\r
-            $extraquery = '';\r
-                   $amountfound = $this->readLogAmount($template, $maxresults, $extraQuery, $query, 1, 1);\r
-               } else {\r
-               \r
-                       // add LIMIT to query (to split search results into pages)\r
-            if (intval($maxresults > 0)) \r
-                   $sqlquery .= ' LIMIT ' . intval($startpos).',' . intval($maxresults);\r
-\r
-                       // show results\r
-                   $amountfound = $this->showUsingQuery($template, $sqlquery, $highlight, 1, 1);\r
-                   \r
-                       // when no results were found, show a message \r
-               if ($amountfound == 0) \r
-               {\r
-                       $template =& $manager->getTemplate($template);\r
-                       $vars = array(\r
-                               'query'         => htmlspecialchars($query),\r
-                               'blogid'        => $this->getID()\r
-                       );\r
-                       echo TEMPLATE::fill($template['SEARCH_NOTHINGFOUND'],$vars);\r
-               }\r
-        }\r
-        \r
-               return $amountfound;\r
-       }\r
-       \r
-       /**\r
-        * Returns an SQL query to use for a search query\r
-        *\r
-        * @param $query\r
-        *              search query\r
-        * @param $amountMonths\r
-        *              amount of months to search back. Default = 0 = unlimited\r
-        * @param $mode\r
-        *              either empty, or 'count'. In this case, the query will be a SELECT COUNT(*) query\r
-        * @returns $highlight\r
-        *              words to highlight (out parameter)\r
-        * @returns \r
-        *              either a full SQL query, or an empty string (if querystring empty)\r
-        * @note\r
-        *              No LIMIT clause is added. (caller should add this if multiple pages are requested)\r
-        */\r
-       function getSqlSearch($query, $amountMonths = 0, &$highlight, $mode = '')\r
-       {\r
-        $searchclass =& new SEARCH($query);\r
-        \r
-        $highlight       = $searchclass->inclusive;\r
-        \r
-        // if querystring is empty, return empty string\r
-        if ($searchclass->inclusive == '') \r
-               return '';\r
-            \r
-           \r
-               $where  = $searchclass->boolean_sql_where('ititle,ibody,imore');\r
-               $select = $searchclass->boolean_sql_select('ititle,ibody,imore');\r
-\r
-               // get list of blogs to search\r
-               $blogs          = $searchclass->blogs;          // array containing blogs that always need to be included\r
-               $blogs[]        = $this->getID();                       // also search current blog (duh)\r
-               $blogs          = array_unique($blogs);         // remove duplicates\r
-               $selectblogs = '';\r
-               if (count($blogs) > 0)\r
-                       $selectblogs = ' and i.iblog in (' . implode(',', $blogs) . ')';\r
-\r
-               if ($mode == '') \r
-               {\r
-                       $query = 'SELECT i.inumber as itemid, i.ititle as title, i.ibody as body, m.mname as author, m.mrealname as authorname, i.itime, i.imore as more, m.mnumber as authorid, m.memail as authormail, m.murl as authorurl, c.cname as category, i.icat as catid, i.iclosed as closed';\r
-                       if ($select) \r
-                               $query .= ', '.$select. ' as score ';\r
-               } else {\r
-                       $query = 'SELECT COUNT(*) as result ';\r
-               }\r
-                       \r
-               $query .= ' FROM '.sql_table('item').' as i, '.sql_table('member').' as m, '.sql_table('category').' as c'\r
-                          . ' WHERE i.iauthor=m.mnumber'\r
-                          . ' and i.icat=c.catid'\r
-                          . ' and i.idraft=0'  // exclude drafts\r
-                          . $selectblogs\r
-                                       // don't show future items\r
-                          . ' and i.itime<=' . mysqldate($this->getCorrectTime())\r
-                          . ' and '.$where;\r
-\r
-               // take into account amount of months to search\r
-               if ($amountMonths > 0) \r
-               {\r
-                       $localtime = getdate($this->getCorrectTime());\r
-                       $timestamp_start = mktime(0,0,0,$localtime['mon'] - $amountMonths,1,$localtime['year']);\r
-                       $query .= ' and i.itime>' . mysqldate($timestamp_start);\r
-               }\r
-\r
-               if ($mode == '')\r
-               {\r
-                       if ($select) \r
-                               $query .= ' ORDER BY score DESC';\r
-                       else \r
-                               $query .= ' ORDER BY i.itime DESC ';\r
-               }\r
-\r
-               return $query;          \r
-       }\r
-       \r
-       /**\r
-        * Returns the SQL query that's normally used to display the blog items on the index type skins\r
-        *\r
-        * @param $mode\r
-        *              either empty, or 'count'. In this case, the query will be a SELECT COUNT(*) query\r
-        * @returns \r
-        *              either a full SQL query, or an empty string \r
-        * @note\r
-        *              No LIMIT clause is added. (caller should add this if multiple pages are requested)\r
-        */\r
-       function getSqlBlog($extraQuery, $mode = '')\r
-       {\r
-               if ($mode == '')\r
-                       $query = 'SELECT i.inumber as itemid, i.ititle as title, i.ibody as body, m.mname as author, m.mrealname as authorname, i.itime, i.imore as more, m.mnumber as authorid, m.memail as authormail, m.murl as authorurl, c.cname as category, i.icat as catid, i.iclosed as closed';\r
-               else\r
-                       $query = 'SELECT COUNT(*) as result ';\r
-               \r
-               $query .= ' FROM '.sql_table('item').' as i, '.sql_table('member').' as m, '.sql_table('category').' as c'\r
-                      . ' WHERE i.iblog='.$this->blogid\r
-                      . ' and i.iauthor=m.mnumber'\r
-                      . ' and i.icat=c.catid'\r
-                      . ' and i.idraft=0'      // exclude drafts\r
-                                       // don't show future items\r
-                      . ' and i.itime<=' . mysqldate($this->getCorrectTime());\r
-\r
-               if ($this->getSelectedCategory())\r
-                       $query .= ' and i.icat=' . $this->getSelectedCategory() . ' ';\r
-\r
-\r
-               $query .= $extraQuery;\r
-               \r
-               if ($mode == '')\r
-                       $query .= ' ORDER BY i.itime DESC';\r
-                      \r
-               return $query;\r
-       }\r
-\r
-       /**\r
-         * Shows the archivelist using the given template\r
-         */\r
-       function showArchiveList($template, $mode = 'month', $limit = 0) {\r
-               global $CONF, $catid, $manager;\r
-\r
-               if ($catid) \r
-                       $linkparams = array('catid' => $catid);\r
-               \r
-               $template =& $manager->getTemplate($template);\r
-               $data['blogid'] = $this->getID();\r
-\r
-               echo TEMPLATE::fill($template['ARCHIVELIST_HEADER'],$data);\r
-\r
-               $query = 'SELECT itime, SUBSTRING(itime,1,4) AS Year, SUBSTRING(itime,6,2) AS Month, SUBSTRING(itime,9,2) as Day FROM '.sql_table('item')\r
-               . ' WHERE iblog=' . $this->getID()\r
-               . ' and itime <=' . mysqldate($this->getCorrectTime())  // don't show future items!\r
-               . ' and idraft=0'; // don't show draft items\r
-               \r
-               if ($catid)\r
-                       $query .= ' and icat=' . intval($catid);\r
-               \r
-               $query .= ' GROUP BY Year, Month';\r
-               if ($mode == 'day')\r
-                       $query .= ', Day';\r
-               \r
-                       \r
-               $query .= ' ORDER BY itime DESC';                               \r
-               \r
-               if ($limit > 0) \r
-                       $query .= ' LIMIT ' . intval($limit);\r
-               \r
-               $res = sql_query($query);\r
-\r
-               while ($current = mysql_fetch_object($res)) {\r
-                       $current->itime = strtotime($current->itime);   // string time -> unix timestamp\r
-               \r
-                       if ($mode == 'day') {\r
-                               $archivedate = date('Y-m-d',$current->itime);\r
-                               $archive['day'] = date('d',$current->itime);\r
-                       } else {\r
-                               $archivedate = date('Y-m',$current->itime);                     \r
-                       }\r
-                       $data['month'] = date('m',$current->itime);\r
-                       $data['year'] = date('Y',$current->itime);\r
-                       $data['archivelink'] = createArchiveLink($this->getID(),$archivedate,$linkparams);\r
-\r
-                       $temp = TEMPLATE::fill($template['ARCHIVELIST_LISTITEM'],$data);\r
-                       echo strftime($temp,$current->itime);\r
-\r
-               }\r
-               \r
-               mysql_free_result($res);\r
-\r
-               echo TEMPLATE::fill($template['ARCHIVELIST_FOOTER'],$data);\r
-       }\r
-       \r
-\r
-       /**\r
-         * Shows the list of categories using a given template\r
-         */\r
-       function showCategoryList($template) {\r
-               global $CONF, $manager;\r
-               \r
-               // determine arguments next to catids\r
-               // I guess this can be done in a better way, but it works\r
-               global $archive, $archivelist;\r
-               \r
-               $linkparams = array();\r
-               if ($archive) {\r
-                       $blogurl = createArchiveLink($this->getID(), $archive, '');\r
-                       $linkparams['blogid'] = $this->getID();\r
-                       $linkparams['archive'] = $archive;\r
-               } else if ($archivelist) {\r
-                       $blogurl = createArchiveListLink($this->getID(), '');\r
-                       $linkparams['archivelist'] = $archivelist;\r
-               } else {\r
-                       $blogurl = createBlogidLink($this->getID(), '');\r
-                       $linkparams['blogid'] = $this->getID();\r
-               } \r
-                       \r
-               //$blogurl = $this->getURL() . $qargs;\r
-               $blogurl = createBlogLink($this->getURL(), $linkparams);\r
-\r
-               $template =& $manager->getTemplate($template);\r
-\r
-               echo TEMPLATE::fill($template['CATLIST_HEADER'],\r
-                                                       array(\r
-                                                               'blogid' => $this->getID(),\r
-                                                               'blogurl' => $blogurl,\r
-                                                               'self' => $CONF['Self']\r
-                                                       ));\r
-\r
-               $query = 'SELECT catid, cdesc as catdesc, cname as catname FROM '.sql_table('category').' WHERE cblog=' . $this->getID() . ' ORDER BY cname ASC';\r
-               $res = sql_query($query);\r
-\r
-\r
-               while ($data = mysql_fetch_assoc($res)) {\r
-                       $data['blogid'] = $this->getID();       \r
-                       $data['blogurl'] = $blogurl;\r
-                       $data['catlink'] = createCategoryLink($data['catid'], $linkparams);\r
-                       $data['self'] = $CONF['Self'];\r
-\r
-                       $temp = TEMPLATE::fill($template['CATLIST_LISTITEM'],$data);\r
-                       echo strftime($temp,$current->itime);\r
-\r
-               }\r
-               \r
-               mysql_free_result($res);\r
-\r
-               echo TEMPLATE::fill($template['CATLIST_FOOTER'],\r
-                                                       array(\r
-                                                               'blogid' => $this->getID(),\r
-                                                               'blogurl' => $blogurl,\r
-                                                               'self' => $CONF['Self']                                                         \r
-                                                       ));\r
-       }\r
-\r
-       /**\r
-         * Blogsettings functions\r
-         */\r
-         \r
-       function readSettings() {\r
-               $query =  'SELECT *'\r
-                      . ' FROM '.sql_table('blog')\r
-                      . ' WHERE bnumber=' . $this->blogid;\r
-               $res = sql_query($query);\r
-               \r
-               $this->isValid = (mysql_num_rows($res) > 0);\r
-               if (!$this->isValid)\r
-                       return;\r
-               \r
-               $this->settings = mysql_fetch_assoc($res);\r
-       }\r
-       \r
-       function writeSettings() {\r
-       \r
-               // (can't use floatval since not available prior to PHP 4.2)\r
-               $offset = $this->getTimeOffset();\r
-               if (!is_float($offset))\r
-                       $offset = intval($offset);\r
-               \r
-               $query =  'UPDATE '.sql_table('blog')\r
-                      . " SET bname='" . addslashes($this->getName()) . "',"\r
-                      . "     bshortname='". addslashes($this->getShortName()) . "',"\r
-                      . "     bcomments=". intval($this->commentsEnabled()) . ","\r
-                      . "     bmaxcomments=" . intval($this->getMaxComments()) . ","\r
-                      . "     btimeoffset=" . $offset . ","\r
-                      . "     bpublic=" . intval($this->isPublic()) . ","\r
-                      . "     bsendping=" . intval($this->pingUserland()) . ","\r
-                      . "     bconvertbreaks=" . intval($this->convertBreaks()) . ","\r
-                      . "     ballowpast=" . intval($this->allowPastPosting()) . ","                      \r
-                      . "     bnotify='" . addslashes($this->getNotifyAddress()) . "',"\r
-                      . "     bnotifytype=" . intval($this->getNotifyType()) . ","                    \r
-                      . "     burl='" . addslashes($this->getURL()) . "',"\r
-                      . "     bupdate='" . addslashes($this->getUpdateFile()) . "',"\r
-                      . "     bdesc='" . addslashes($this->getDescription()) . "',"\r
-                      . "     bdefcat=" . intval($this->getDefaultCategory()) . ","                   \r
-                      . "     bdefskin=" . intval($this->getDefaultSkin()) . ","\r
-                      . "     bincludesearch=" . intval($this->getSearchable())\r
-                      . " WHERE bnumber=" . intval($this->getID());\r
-               sql_query($query);\r
-\r
-       }\r
-       \r
-\r
-               \r
-       // update update file if requested\r
-       function updateUpdatefile() {\r
-                if ($this->getUpdateFile()) {\r
-                       $f_update = fopen($this->getUpdateFile(),'w');\r
-                       fputs($f_update,$this->getCorrectTime());\r
-                       fclose($f_update);\r
-                }\r
-\r
-       }\r
-       \r
-       /**\r
-         * Sends a XML-RPC ping message to Userland, so the weblog can\r
-         * show up in the weblogs.com updates-list\r
-         */\r
-       function sendUserlandPing() {\r
-               global $php_errormsg;\r
-               \r
-                if ($this->pingUserland()) {\r
-                         // testmessage for adding an item\r
-                         $message = new xmlrpcmsg('weblogUpdates.ping',array(\r
-                                       new xmlrpcval($this->getName(),'string'),       \r
-                                       new xmlrpcval($this->getURL(),'string')\r
-                         ));\r
-                         \r
-                         $c = new xmlrpc_client('/RPC2', 'rpc.weblogs.com', 80);\r
-\r
-                         // $c->setDebug(1);\r
-\r
-                         $r = $c->send($message,15); // 15 seconds timeout...\r
-                         \r
-                         if (($r == 0) && ($r->errno || $r->errstring)) {\r
-                               return 'Error ' . $r->errno . ' : ' . $r->errstring;\r
-                         } elseif (($r == 0) && ($php_errormsg)) {\r
-                               return 'PHP Error: ' . $php_errormsg;\r
-                         } elseif ($r == 0) {\r
-                               return 'Error while trying to send ping. Sorry about that.';\r
-                         } elseif ($r->faultCode() != 0) {\r
-                               return 'Error: ' . $r->faultString();\r
-                         } else {\r
-                                 $r = $r->value();     // get response struct\r
-                                 // get values\r
-                                 $flerror = $r->structmem('flerror');\r
-                                 $flerror = $flerror->scalarval();\r
\r
-                                 \r
-                                 $message = $r->structmem('message');\r
-                                 $message = $message->scalarval();\r
-\r
-                                 if ($flerror != 0)\r
-                                       return 'Error (flerror=1): ' . $message;\r
-                                 else\r
-                                       return 'Success: ' . $message;\r
-                         }                       \r
-                }\r
-       }\r
-       \r
-       function isValidCategory($catid) {\r
-               $query = 'SELECT * FROM '.sql_table('category').' WHERE cblog=' . $this->getID() . ' and catid=' . intval($catid);\r
-               return (mysql_num_rows(mysql_query($query)) != 0);\r
-       }\r
-       \r
-       function getCategoryName($catid) {\r
-               $res = mysql_query('SELECT cname FROM '.sql_table('category').' WHERE cblog='.$this->getID().' and catid=' . intval($catid));\r
-               $o = mysql_fetch_object($res);\r
-               return $o->cname;\r
-       }\r
-       \r
-       function getCategoryDesc($catid) {\r
-               $res = mysql_query('SELECT cdesc FROM '.sql_table('category').' WHERE cblog='.$this->getID().' and catid=' . intval($catid));\r
-               $o = mysql_fetch_object($res);\r
-               return $o->cdesc;\r
-       }\r
-\r
-       function getCategoryIdFromName($name) {\r
-               $res = mysql_query('SELECT catid FROM '.sql_table('category').' WHERE cblog='.$this->getID().' and cname="' . addslashes($name) . '"');\r
-               if (mysql_num_rows($res) > 0) {\r
-                       $o = mysql_fetch_object($res);\r
-                       return $o->catid;       \r
-               } else {\r
-                       return $this->getDefaultCategory();\r
-               }\r
-       }\r
-       \r
-       function pingUserland() {\r
-               return $this->getSetting('bsendping');\r
-       }\r
-       \r
-       function setPingUserland($val) {\r
-               $this->setSetting('bsendping',$val);\r
-       }\r
-       \r
-       function convertBreaks() {\r
-               return $this->getSetting('bconvertbreaks');\r
-       }\r
-       \r
-       function insertJavaScriptInfo($authorid = '') {\r
-               global $member, $CONF;\r
-               \r
-               if ($authorid == '')    \r
-                       $authorid = $member->getID();\r
-                       \r
-               ?>\r
-               <script type="text/javascript">\r
-                       setConvertBreaks(<?php echo  $this->convertBreaks() ? 'true' : 'false' ?>);\r
-                       setMediaUrl("<?php echo $CONF['MediaURL']?>");\r
-                       setAuthorId(<?php echo $authorid?>);\r
-               </script><?php  }\r
-       \r
-       function setConvertBreaks($val) {\r
-               $this->setSetting('bconvertbreaks',$val);\r
-       }\r
-       function setAllowPastPosting($val) {\r
-               $this->setSetting('ballowpast',$val);\r
-       }               \r
-       function allowPastPosting() {\r
-               return $this->getSetting('ballowpast');\r
-       }\r
-       \r
-       function getCorrectTime($t=0) {\r
-               if ($t == 0) $t = time();\r
-               return ($t + 3600 * $this->getTimeOffset());\r
-       }\r
-       \r
-       function getName() {\r
-               return $this->getSetting('bname');\r
-       }\r
-       \r
-       function getShortName() {\r
-               return $this->getSetting('bshortname');\r
-       }\r
-       \r
-       function getMaxComments() {\r
-               return $this->getSetting('bmaxcomments');\r
-       }\r
-       \r
-       function getNotifyAddress() {\r
-               return $this->getSetting('bnotify');\r
-       }\r
-       \r
-       function getNotifyType() {\r
-               return $this->getSetting('bnotifytype');\r
-       }\r
-       \r
-       function notifyOnComment() {\r
-               $n = $this->getNotifyType();\r
-               return (($n != 0) && (($n % 3) == 0));\r
-       }\r
-\r
-       function notifyOnVote() {\r
-               $n = $this->getNotifyType();\r
-               return (($n != 0) && (($n % 5) == 0));\r
-       }\r
-\r
-       function notifyOnNewItem() {\r
-               $n = $this->getNotifyType();\r
-               return (($n != 0) && (($n % 7) == 0));\r
-       }\r
-       \r
-       function setNotifyType($val) {\r
-               $this->setSetting('bnotifytype',$val);  \r
-       }\r
-       \r
-\r
-       function getTimeOffset() {\r
-               return $this->getSetting('btimeoffset');\r
-       }\r
-       \r
-       function commentsEnabled() {\r
-               return $this->getSetting('bcomments');\r
-       }\r
-       \r
-       function getURL() {\r
-               return $this->getSetting('burl');\r
-       }\r
-       \r
-       function getDefaultSkin() {\r
-               return $this->getSetting('bdefskin');\r
-       }\r
-       \r
-       function getUpdateFile() {\r
-               return $this->getSetting('bupdate');\r
-       }\r
-       \r
-       function getDescription() {\r
-               return $this->getSetting('bdesc');\r
-       }\r
-       \r
-       function isPublic() {\r
-               return $this->getSetting('bpublic');\r
-       }\r
-       \r
-       function getSearchable() {\r
-               return $this->getSetting('bincludesearch');\r
-       }\r
-\r
-       function getDefaultCategory() {\r
-               return $this->getSetting('bdefcat');\r
-       }\r
-       \r
-       function setPublic($val) {\r
-               $this->setSetting('bpublic',$val);\r
-       }\r
-\r
-       function setSearchable($val) {\r
-               $this->setSetting('bincludesearch',$val);\r
-       }\r
-\r
-       function setDescription($val) {\r
-               $this->setSetting('bdesc',$val);\r
-       }\r
-\r
-       function setUpdateFile($val) {\r
-               $this->setSetting('bupdate',$val);\r
-       }\r
-       \r
-       function setDefaultSkin($val) {\r
-               $this->setSetting('bdefskin',$val);\r
-       }\r
-       \r
-       function setURL($val) {\r
-               $this->setSetting('burl',$val);\r
-       }\r
-       \r
-       function setName($val) {\r
-               $this->setSetting('bname',$val);\r
-       }\r
-       \r
-       function setShortName($val) {\r
-               $this->setSetting('bshortname',$val);\r
-       }\r
-       \r
-       function setCommentsEnabled($val) { \r
-               $this->setSetting('bcomments',$val);\r
-       }\r
-       \r
-       function setMaxComments($val) {\r
-               $this->setSetting('bmaxcomments',$val);\r
-       }\r
-       \r
-       function setNotifyAddress($val) {\r
-               $this->setSetting('bnotify',$val);\r
-       }\r
-       \r
-       function setTimeOffset($val) {\r
-               // check validity of value\r
-               // 1. replace , by . (common mistake)\r
-               $val = str_replace(',','.',$val);\r
-               // 2. cast to float or int\r
-               if (is_numeric($val) && strstr($val,'.5')) {\r
-                       $val = (float) $val;\r
-               } else {\r
-                       $val = intval($val);\r
-               }\r
-       \r
-               $this->setSetting('btimeoffset',$val);\r
-       }\r
-       \r
-       function setDefaultCategory($val) {\r
-               $this->setSetting('bdefcat',$val);\r
-       }\r
-\r
-       function getSetting($key) {\r
-               return $this->settings[$key];\r
-       }\r
-       \r
-       function setSetting($key,$value) {\r
-               $this->settings[$key] = $value;\r
-       }\r
-       \r
-       \r
-       // tries to add a member to the team. Returns false if the member was already on\r
-       // the team\r
-       function addTeamMember($memberid, $admin) {\r
-               global $manager;\r
-               \r
-               $memberid = intval($memberid);\r
-               $admin = intval($admin);\r
-               \r
-               // check if member is already a member\r
-               $tmem = MEMBER::createFromID($memberid);\r
-               \r
-               if ($tmem->isTeamMember($this->getID()))\r
-                       return 0;\r
-               \r
-               $manager->notify(\r
-                       'PreAddTeamMember',\r
-                       array(\r
-                               'blog' => &$this,\r
-                               'member' => &$tmem,\r
-                               'admin' => &$admin\r
-                       )\r
-               );\r
-               \r
-               // add to team\r
-               $query = 'INSERT INTO '.sql_table('team').' (TMEMBER, TBLOG, TADMIN) '\r
-                      . 'VALUES (' . $memberid .', '.$this->getID().', "'.$admin.'")';\r
-               sql_query($query);\r
-               \r
-               $manager->notify(\r
-                       'PostAddTeamMember',\r
-                       array(\r
-                               'blog' => &$this,\r
-                               'member' => &$tmem,\r
-                               'admin' => $admin\r
-                       )\r
-                       \r
-               );\r
-               \r
-               ACTIONLOG::add(INFO, 'Added ' . $tmem->getDisplayName() . ' (ID=' .\r
-                              $memberid .') to the team of blog "' . $this->getName() . '"');\r
-               \r
-               return 1;\r
-       }\r
-       \r
-       function getID() {\r
-               return $this->blogid;\r
-       }\r
-       \r
-       // returns true if there is a blog with the given shortname (static)\r
-       function exists($name) {\r
-               $r = sql_query('select * FROM '.sql_table('blog').' WHERE bshortname="'.addslashes($name).'"');\r
-               return (mysql_num_rows($r) != 0);\r
-       }\r
-\r
-       // returns true if there is a blog with the given ID (static)\r
-       function existsID($id) {\r
-               $r = sql_query('select * FROM '.sql_table('blog').' WHERE bnumber='.intval($id));\r
-               return (mysql_num_rows($r) != 0);\r
-       }       \r
-       \r
-       \r
-}\r
-\r
-/**\r
-  * This class is used when parsing item templates\r
-  */\r
-class ITEMACTIONS extends BaseActions {\r
-\r
-       // contains an assoc array with parameters that need to be included when\r
-       // generating links to items/archives/... (e.g. catid)\r
-       var $linkparams;\r
-       \r
-       // true when the current user is a blog admin (and thus allowed to edit all items)\r
-       var $allowEditAll;\r
-       \r
-       // timestamp of last visit\r
-       var $lastVisit;\r
-       \r
-       // item currently being handled (mysql result object, see BLOG::showUsingQuery)\r
-       var $currentItem;\r
-       \r
-       // reference to the blog currently being displayed\r
-       var $blog;\r
-       \r
-       // associative array with template info (part name => contents)\r
-       var $template;\r
-       \r
-       // true when comments need to be displayed\r
-       var $showComments;\r
-       \r
-       function ITEMACTIONS(&$blog) {\r
-               // call constructor of superclass first\r
-               $this->BaseActions();   \r
-               \r
-               // extra parameters for created links\r
-               global $catid;\r
-               if ($catid)\r
-                       $this->linkparams = array('catid' => $catid);\r
-                       \r
-               // check if member is blog admin (and thus allowed to edit all items)\r
-               global $member;\r
-               $this->allowEditAll = ($member->isLoggedIn() && $member->blogAdminRights($blog->getID()));\r
-               $this->setBlog($blog);\r
-       }\r
-\r
-       function getDefinedActions() {\r
-               return array(\r
-                       'blogid',\r
-                       'title',\r
-                       'body',\r
-                       'more',\r
-                       'smartbody',\r
-                       'itemid',\r
-                       'morelink',\r
-                       'category',\r
-                       'categorylink',\r
-                       'author',\r
-                       'authorid',\r
-                       'authorlink',\r
-                       'catid',\r
-                       'karma',\r
-                       'date',\r
-                       'time',\r
-                       'query',\r
-                       'itemlink',\r
-                       'blogurl',\r
-                       'closed',\r
-                       'syndicate_title',\r
-                       'syndicate_description',\r
-                       'karmaposlink',\r
-                       'karmaneglink',\r
-                       'new',\r
-                       'image',\r
-                       'popup',\r
-                       'media',\r
-                       'daylink',\r
-                       'query',\r
-                       'include',\r
-                       'phpinclude',\r
-                       'parsedinclude',\r
-                       'skinfile',\r
-                       'set',\r
-                       'plugin',\r
-                       'edit',\r
-                       'editlink',\r
-                       'editpopupcode',\r
-                       'comments',\r
-                       'relevance'\r
-               );\r
-       }\r
-       \r
-\r
-       \r
-       function setLastVisit($lastVisit) {             $this->lastVisit = $lastVisit; }\r
-       function setParser(&$parser) {                  $this->parser =& $parser; }\r
-       function setCurrentItem(&$item) {               $this->currentItem =& $item; }\r
-       function setBlog(&$blog) {                              $this->blog =& $blog; }\r
-       function setTemplate($template) {               $this->template =& $template; }\r
-       function setShowComments($val) {                $this->showComments = $val; }\r
-       \r
-       // methods used by parser to insert content\r
-       \r
-       function parse_blogid() {               echo $this->blog->getID();      }\r
-       function parse_body() {                 $this->highlightAndParse($this->currentItem->body); }\r
-       function parse_title() {                $this->highlightAndParse($this->currentItem->title); }\r
-       function parse_more() {                 $this->highlightAndParse($this->currentItem->more); }   \r
-       function parse_itemid() {               echo $this->currentItem->itemid; }              \r
-       function parse_category() {             echo $this->currentItem->category; }                            \r
-       function parse_categorylink() { echo createCategoryLink($this->currentItem->catid); }                           \r
-       function parse_catid() {                echo $this->currentItem->catid; }                                       \r
-       function parse_authorid() {             echo $this->currentItem->authorid; }\r
-       function parse_authorlink() {   echo createMemberLink($this->currentItem->authorid, $this->linkparams); }       \r
-       function parse_query() {                echo $this->strHighlight; }\r
-       function parse_itemlink() {             echo createItemLink($this->currentItem->itemid, $this->linkparams); }\r
-       function parse_blogurl() {              echo $this->blog->getURL(); }\r
-       function parse_closed() {               echo $this->currentItem->closed; }\r
-       function parse_relevance() {    echo round($this->currentItem->score,2);}\r
-       \r
-       function parse_karma($type = 'totalscore') {\r
-               global $manager;\r
-\r
-               // get karma object\r
-               $karma =& $manager->getKarma($this->currentItem->itemid);\r
-               \r
-               switch($type) {\r
-                       case 'pos':\r
-                               echo $karma->getNbPosVotes();\r
-                               break;\r
-                       case 'neg':\r
-                               echo $karma->getNbNegVotes();\r
-                               break;                          \r
-                       case 'votes':\r
-                               echo $karma->getNbOfVotes();\r
-                               break;          \r
-                       case 'posp':\r
-                               $percentage = $karma->getNbOfVotes() ? 100 * ($karma->getNbPosVotes() / $karma->getNbOfVotes()) : 50;\r
-                               echo number_format($percentage,2), '%';                         \r
-                               break;                          \r
-                       case 'negp':\r
-                               $percentage = $karma->getNbOfVotes() ? 100 * ($karma->getNbNegVotes() / $karma->getNbOfVotes()) : 50;\r
-                               echo number_format($percentage,2), '%';                         \r
-                               break;                          \r
-                       case 'totalscore':\r
-                       default:\r
-                               echo $karma->getTotalScore();\r
-                               break;\r
-               }\r
-               \r
-       }                                               \r
-\r
-       function parse_author($which = '') {            \r
-               switch($which)\r
-               {\r
-                       case 'realname':\r
-                               echo $this->currentItem->authorname;\r
-                               break;\r
-                       case 'id':\r
-                               echo $this->currentItem->authorid;\r
-                               break;\r
-                       case 'email':\r
-                               echo $this->currentItem->authormail;\r
-                               break;\r
-                       case 'url':\r
-                               echo $this->currentItem->authorurl;\r
-                               break;\r
-                       case 'name':\r
-                       default:\r
-                               echo $this->currentItem->author;\r
-               }\r
-       }               \r
-       \r
-       function parse_smartbody() {\r
-               if (!$this->currentItem->more) {\r
-                       $this->highlightAndParse($this->currentItem->body);\r
-               } else {\r
-                       $this->highlightAndParse($this->currentItem->more);             \r
-               }\r
-       }\r
-\r
-       function parse_morelink() {             \r
-               if ($this->currentItem->more)\r
-                       $this->parser->parse($this->template['MORELINK']);\r
-       }                       \r
-       \r
-       function parse_date($format = '') {\r
-               echo formatDate($format, $this->currentItem->timestamp, $this->template['FORMAT_DATE']);\r
-       }\r
-       \r
-       /**\r
-         * @param format optional strftime format\r
-         */\r
-       function parse_time($format = '') {                     \r
-               echo strftime($format ? $format : $this->template['FORMAT_TIME'],$this->currentItem->timestamp); \r
-       }\r
-       \r
-       /**\r
-         * @param maxLength optional maximum length\r
-         */\r
-       function parse_syndicate_title($maxLength = 100) { \r
-               $syndicated = strip_tags($this->currentItem->title);\r
-               echo htmlspecialchars(shorten($syndicated,$maxLength,'...'));\r
-       }\r
-       \r
-       /**\r
-         * @param maxLength optional maximum length\r
-         */\r
-       function parse_syndicate_description($maxLength = 250, $addHighlight = 0) { \r
-               $syndicated = strip_tags($this->currentItem->body);\r
-               if ($addHighlight) {\r
-                   echo $this->highlightAndParse(htmlspecialchars(shorten($syndicated,$maxLength,'...')));\r
-               } else {\r
-               echo htmlspecialchars(shorten($syndicated,$maxLength,'...'));\r
-               }\r
-       }\r
-       \r
-       function parse_karmaposlink($text = '') { \r
-               global $CONF;\r
-               $link = $CONF['ActionURL'] . '?action=votepositive&amp;itemid='.$this->currentItem->itemid; \r
-               echo $text ? '<a href="'.$link.'">'.$text.'</a>' : $link;\r
-       }\r
-       \r
-       function parse_karmaneglink($text = '') { \r
-               global $CONF;\r
-               $link = $CONF['ActionURL'] . '?action=votenegative&amp;itemid='.$this->currentItem->itemid; \r
-               echo $text ? '<a href="'.$link.'">'.$text.'</a>' : $link;\r
-       }\r
-       \r
-       function parse_new() {  \r
-               if (($this->lastVisit != 0) && ($this->currentItem->timestamp > $this->lastVisit))\r
-                       echo $this->template['NEW'];\r
-       }\r
-       \r
-       function parse_image() {\r
-               // image/popup calls have arguments separated by |\r
-               $args = func_get_args();\r
-               $args = explode('|',implode($args,', '));\r
-               call_user_func_array(array(&$this,'createImageCode'),$args);\r
-       }\r
-       function parse_popup() {\r
-               // image/popup calls have arguments separated by |\r
-               $args = func_get_args();\r
-               $args = explode('|',implode($args,', '));\r
-               call_user_func_array(array(&$this,'createPopupCode'),$args);\r
-       }\r
-       function parse_media() {\r
-               // image/popup calls have arguments separated by |\r
-               $args = func_get_args();\r
-               $args = explode('|',implode($args,', '));\r
-               call_user_func_array(array(&$this,'createMediaCode'),$args);\r
-       }\r
-       \r
-       function parse_daylink() {              \r
-               echo createArchiveLink($this->blog->getID(), strftime('%Y-%m-%d',$this->currentItem->timestamp), $this->linkparams);\r
-       }\r
-       \r
-       function parse_comments($maxToShow = 0) {\r
-               if ($maxToShow == 0)\r
-                       $maxToShow = $this->blog->getMaxComments();\r
-                       \r
-               // add comments\r
-               if ($this->showComments && $this->blog->commentsEnabled()) {\r
-                       $comments =& new COMMENTS($this->currentItem->itemid);\r
-                       $comments->setItemActions($this);\r
-                       $comments->showComments($this->template, $maxToShow, $this->currentItem->closed ? 0 : 1, $this->strHighlight); \r
-               }\r
-       }\r
-\r
-       /**\r
-         * Executes a plugin templatevar\r
-         *\r
-         * @param pluginName name of plugin (without the NP_)\r
-         * \r
-         * extra parameters can be added\r
-         */\r
-       function parse_plugin($pluginName) {\r
-               global $manager;\r
-               \r
-               // only continue when the plugin is really installed\r
-               if (!$manager->pluginInstalled('NP_' . $pluginName))\r
-                       return;\r
-               \r
-               $plugin =& $manager->getPlugin('NP_' . $pluginName);\r
-               if (!$plugin) return;\r
-\r
-               // get arguments\r
-               $params = func_get_args();\r
-               \r
-               // remove plugin name \r
-               array_shift($params);\r
-               \r
-               // add item reference (array_unshift didn't work)\r
-               $params = array_merge(array(&$this->currentItem),$params);\r
-\r
-               call_user_func_array(array(&$plugin,'doTemplateVar'), $params);\r
-       }\r
-       \r
-       function parse_edit() {\r
-               global $member, $CONF;\r
-               if ($this->allowEditAll || ($member->isLoggedIn() && ($member->getID() == $this->currentItem->authorid)) ) {\r
-                       $this->parser->parse($this->template['EDITLINK']);\r
-               }\r
-       }\r
-       \r
-       function parse_editlink() {\r
-               global $CONF;\r
-               echo $CONF['AdminURL'],'bookmarklet.php?action=edit&amp;itemid=',$this->currentItem->itemid;\r
-       }\r
-       \r
-       function parse_editpopupcode() {\r
-               echo "if (event &amp;&amp; event.preventDefault) event.preventDefault();winbm=window.open(this.href,'nucleusbm','scrollbars=yes,width=600,height=500,left=10,top=10,status=yes,resizable=yes');winbm.focus();return false;";\r
-       }\r
-       \r
-       // helper functions\r
-\r
-       /**\r
-         * Parses highlighted text, with limited actions only (to prevent not fully trusted team members\r
-         * from hacking your weblog. \r
-         */\r
-       function highlightAndParse(&$data) {\r
-               // allow only a limited subset of actions (do not allow includes etc, they might be evil)\r
-               $this->parser->actions = array('image','media','popup');\r
-               $this->parser->parse($this->highlight($data));\r
-               $this->parser->actions = $this->getDefinedActions();\r
-       }\r
-       \r
-       function createPopupCode($filename, $width, $height, $text = '') {\r
-               global $CONF;\r
-       \r
-               // select private collection when no collection given\r
-               if (!strstr($filename,'/')) {\r
-                       $filename = $this->currentItem->authorid . '/' . $filename;\r
-               }\r
-               \r
-               $windowwidth = $width;\r
-               $windowheight = $height;\r
-               \r
-               $vars['rawpopuplink']   = $CONF['Self'] . "?imagepopup=" . htmlspecialchars($filename) . "&amp;width=$width&amp;height=$height&amp;imagetext=" . urlencode(htmlspecialchars($text));\r
-               $vars['popupcode']              = "window.open(this.href,'imagepopup','status=no,toolbar=no,scrollbars=no,resizable=yes,width=$windowwidth,height=$windowheight');return false;";\r
-               $vars['popuptext']              = htmlspecialchars($text);\r
-               $vars['popuplink']              = '<a href="' . $vars['rawpopuplink']. '" onclick="'. $vars['popupcode'].'" >' . $vars['popuptext'] . '</a>';\r
-               $vars['width']                  = $width;\r
-               $vars['height']                 = $height;\r
-               $vars['text']                   = $text;\r
-               \r
-               echo TEMPLATE::fill($this->template['POPUP_CODE'],$vars);\r
-       }\r
-       \r
-       function createImageCode($filename, $width, $height, $text = '') {\r
-               global $CONF;\r
-               \r
-               // select private collection when no collection given\r
-               if (!strstr($filename,'/')) {\r
-                       $filename = $this->currentItem->authorid . '/' . $filename;\r
-               }\r
-               \r
-               $windowwidth = $width;\r
-               $windowheight = $height;\r
-               \r
-               $vars['link']                   = htmlspecialchars($CONF['MediaURL']. $filename);\r
-               $vars['text']                   = htmlspecialchars($text);\r
-               $vars['image'] = '<img src="' . $vars['link'] . '" width="' . $width . '" height="' . $height . '" alt="' . $vars['text'] . '" title="' . $vars['text'] . '" />';\r
-               $vars['width']                  = $width;\r
-               $vars['height']                 = $height;\r
-                               \r
-               \r
-               \r
-               echo TEMPLATE::fill($this->template['IMAGE_CODE'],$vars);;\r
-\r
-       }\r
-       \r
-       function createMediaCode($filename, $text = '') {\r
-               global $CONF;\r
-               \r
-               // select private collection when no collection given\r
-               if (!strstr($filename,'/')) {\r
-                       $filename = $this->currentItem->authorid . '/' . $filename;\r
-               }               \r
-\r
-               $vars['link']                   = htmlspecialchars($CONF['MediaURL'] . $filename);\r
-               $vars['text']                   = htmlspecialchars($text);\r
-               $vars['media']                  = '<a href="' . $vars['link'] . '">' . $vars['text'] . '</a>';\r
-\r
-               echo TEMPLATE::fill($this->template['MEDIA_CODE'],$vars);;\r
-       }\r
-       \r
-       \r
-}\r
-\r
-\r
-// used for mail notification (html -> text)\r
-\r
-function toAscii($html) {\r
-       // strip off most tags \r
-       $html = strip_tags($html,'<a>');\r
-       $to_replace = "/<a[^>]*href=[\"\']([^\"^']*)[\"\'][^>]*>([^<]*)<\/a>/i"; \r
-       _links_init(); \r
-       $ascii = preg_replace_callback ($to_replace, '_links_add', $html); \r
-       $ascii .= "\n\n" . _links_list(); \r
-       return strip_tags($ascii);\r
-}\r
-\r
-function _links_init() { \r
-   global $tmp_links; \r
-   $tmp_links = array(); \r
-} \r
-\r
-function _links_add($match) { \r
-   global $tmp_links; \r
-   array_push($tmp_links, $match[1]); \r
-   return $match[2] . ' [' . sizeof($tmp_links) .']'; \r
-} \r
-\r
-function _links_list() { \r
-   global $tmp_links; \r
-   $output = ''; \r
-   $i = 1; \r
-   foreach ($tmp_links as $current) { \r
-      $output .= "[$i] $current\n"; \r
-      $i++; \r
-   } \r
-   return $output; \r
-} \r
-\r
\r
-?>\r
+<?php
+
+/*
+ * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
+ * Copyright (C) 2002-2006 The Nucleus Group
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * (see nucleus/documentation/index.html#license for more info)
+ */
+/**
+ * A class representing a blog and containing functions to get that blog shown
+ * on the screen
+ *
+ * @license http://nucleuscms.org/license.txt GNU General Public License
+ * @copyright Copyright (C) 2002-2006 The Nucleus Group
+ * @version $Id: BLOG.php,v 1.5 2006-07-17 20:03:44 kimitake Exp $
+ * $NucleusJP: BLOG.php,v 1.4 2005/08/13 07:31:04 kimitake Exp $
+ */
+
+// temporary: dirt way to separe class ITEMACTIONS from BLOG
+require_once $DIR_LIBS . 'ITEMACTIONS.php';
+
+class BLOG {
+
+       // blog id
+       var $blogid;
+
+       // ID of currently selected category
+       var $selectedcatid;
+
+       // After creating an object of the blog class, contains true if the BLOG object is
+       // valid (the blog exists)
+       var $isValid;
+
+       // associative array, containing all blogsettings (use the get/set functions instead)
+       var $settings;
+
+       /**
+        * Creates a new BLOG object for the given blog
+        *
+        * @param $id blogid
+        */
+       function BLOG($id) {
+               $this->blogid = intval($id);
+               $this->readSettings();
+
+               // try to set catid
+               // (the parse functions in SKIN.php will override this, so it's mainly useless)
+               global $catid;
+               $this->setSelectedCategory($catid);
+       }
+
+       /**
+        * Shows the given amount of items for this blog
+        *
+        * @param $template
+        *              String representing the template _NAME_ (!)
+        * @param $amountEntries
+        *              amount of entries to show
+        * @param $startpos
+        *              offset from where items should be shown (e.g. 5 = start at fifth item)
+        * @returns int
+        *              amount of items shown
+        */
+       function readLog($template, $amountEntries, $offset = 0, $startpos = 0) {
+               return $this->readLogAmount($template,$amountEntries,'','',1,1,$offset, $startpos);
+       }
+
+       /**
+        * Shows an archive for a given month
+        *
+        * @param $year
+        *              year
+        * @param $month
+        *              month
+        * @param $template
+        *              String representing the template name to be used
+        */
+       function showArchive($templatename, $year, $month, $day=0) {
+
+               // create extra where clause for select query
+               if ($day == 0) {
+                       $timestamp_start = mktime(0,0,0,$month,1,$year);
+                       $timestamp_end = mktime(0,0,0,$month+1,1,$year);  // also works when $month==12
+               } else {
+                       $timestamp_start = mktime(0,0,0,$month,$day,$year);
+                       $timestamp_end = mktime(0,0,0,$month,$day+1,$year);
+               }
+               $extra_query = ' and i.itime>=' . mysqldate($timestamp_start)
+                                        . ' and i.itime<' . mysqldate($timestamp_end);
+
+
+               $this->readLogAmount($templatename,0,$extra_query,'',1,1);
+
+       }
+
+
+       // sets/gets current category (only when category exists)
+       function setSelectedCategory($catid) {
+               if ($this->isValidCategory($catid) || (intval($catid) == 0))
+                       $this->selectedcatid = intval($catid);
+       }
+
+       function setSelectedCategoryByName($catname) {
+               $this->setSelectedCategory($this->getCategoryIdFromName($catname));
+       }
+
+       function getSelectedCategory() {
+               return $this->selectedcatid;
+       }
+
+       /**
+        * Shows the given amount of items for this blog
+        *
+        * @param $template
+        *              String representing the template _NAME_ (!)
+        * @param $amountEntries
+        *              amount of entries to show (0 = no limit)
+        * @param $extraQuery
+        *              extra conditions to be added to the query
+        * @param $highlight
+        *              contains a query that should be highlighted
+        * @param $comments
+        *              1=show comments 0=don't show comments
+        * @param $dateheads
+        *              1=show dateheads 0=don't show dateheads
+        * @param $offset
+        *              offset
+        * @returns int
+        *              amount of items shown
+        */
+       function readLogAmount($template, $amountEntries, $extraQuery, $highlight, $comments, $dateheads, $offset = 0, $startpos = 0) {
+
+               $query = $this->getSqlBlog($extraQuery);
+
+               if ($amountEntries > 0) {
+                               // $offset zou moeten worden:
+                               // (($startpos / $amountentries) + 1) * $offset ... later testen ...
+                          $query .= ' LIMIT ' . intval($startpos + $offset).',' . intval($amountEntries);
+               }
+               return $this->showUsingQuery($template, $query, $highlight, $comments, $dateheads);
+       }
+
+       function showUsingQuery($templateName, $query, $highlight = '', $comments = 0, $dateheads = 1) {
+               global $CONF, $manager;
+
+               $lastVisit = cookieVar($CONF['CookiePrefix'] .'lastVisit');
+               if ($lastVisit != 0)
+                       $lastVisit = $this->getCorrectTime($lastVisit);
+
+               // set templatename as global variable (so plugins can access it)
+               global $currentTemplateName;
+               $currentTemplateName = $templateName;
+
+               $template =& $manager->getTemplate($templateName);
+
+               // create parser object & action handler
+               $actions =& new ITEMACTIONS($this);
+               $parser =& new PARSER($actions->getDefinedActions(),$actions);
+               $actions->setTemplate($template);
+               $actions->setHighlight($highlight);
+               $actions->setLastVisit($lastVisit);
+               $actions->setParser($parser);
+               $actions->setShowComments($comments);
+
+               // execute query
+               $items = sql_query($query);
+
+               // loop over all items
+               while ($item = mysql_fetch_object($items)) {
+
+                       $item->timestamp = strtotime($item->itime);     // string timestamp -> unix timestamp
+
+                       // action handler needs to know the item we're handling
+                       $actions->setCurrentItem($item);
+
+                       // add date header if needed
+                       $old_date = 0;
+                       if ($dateheads) {
+                               $new_date = date('dFY',$item->timestamp);
+                               if ($new_date != $old_date) {
+                                       // unless this is the first time, write date footer
+                                       $timestamp = $item->timestamp;
+                                       if ($old_date != 0) {
+                                               $oldTS = strtotime($old_date);
+                                               $manager->notify('PreDateFoot',array('blog' => &$this, 'timestamp' => $oldTS));
+                                               $tmp_footer = strftime($template['DATE_FOOTER'], $oldTS);
+                                               $parser->parse($tmp_footer);
+                                               $manager->notify('PostDateFoot',array('blog' => &$this, 'timestamp' => $oldTS));
+                                       }
+                                       $manager->notify('PreDateHead',array('blog' => &$this, 'timestamp' => $timestamp));
+                                       // note, to use templatvars in the dateheader, the %-characters need to be doubled in
+                                       // order to be preserved by strftime
+                                       $tmp_header = strftime((isset($template['DATE_HEADER']) ? $template['DATE_HEADER'] : null), $timestamp);
+                                       $parser->parse($tmp_header);
+                                       $manager->notify('PostDateHead',array('blog' => &$this, 'timestamp' => $timestamp));
+                               }
+                               $old_date = $new_date;
+                       }
+
+                       // parse item
+                       $parser->parse($template['ITEM_HEADER']);
+                       $manager->notify('PreItem', array('blog' => &$this, 'item' => &$item));
+                       $parser->parse($template['ITEM']);
+                       $manager->notify('PostItem', array('blog' => &$this, 'item' => &$item));
+                       $parser->parse($template['ITEM_FOOTER']);
+
+               }
+
+               $numrows = mysql_num_rows($items);
+
+               // add another date footer if there was at least one item
+               if (($numrows > 0) && $dateheads) {
+                       $manager->notify('PreDateFoot',array('blog' => &$this, 'timestamp' => strtotime($old_date)));
+                       $parser->parse($template['DATE_FOOTER']);
+                       $manager->notify('PostDateFoot',array('blog' => &$this, 'timestamp' => strtotime($old_date)));
+               }
+
+               mysql_free_result($items);      // free memory
+
+               return $numrows;
+
+       }
+
+       function showOneitem($itemid, $template, $highlight) {
+               $extraQuery = ' and inumber=' . intval($itemid);
+
+               return $this->readLogAmount($template, 1, $extraQuery, $highlight, 0, 0);
+       }
+
+
+       /**
+         * Adds an item to this blog
+         */
+       function additem($catid, $title, $body, $more, $blogid, $authorid, $timestamp, $closed, $draft) {
+               global $manager;
+
+               $blogid         = intval($blogid);
+               $authorid       = intval($authorid);
+               $title          = $title;
+               $body           = $body;
+               $more           = $more;
+               $catid          = intval($catid);
+
+               // convert newlines to <br />
+               if ($this->convertBreaks()) {
+                       $body = addBreaks($body);
+                       $more = addBreaks($more);
+               }
+
+               if ($closed != '1')     $closed = '0';
+               if ($draft != '0') $draft = '1';
+
+               if (!$this->isValidCategory($catid))
+                       $catid = $this->getDefaultCategory();
+
+               if ($timestamp > $this->getCorrectTime())
+                       $isFuture = 1;
+
+               $timestamp = date('Y-m-d H:i:s',$timestamp);
+
+               $manager->notify('PreAddItem',array('title' => &$title, 'body' => &$body, 'more' => &$more, 'blog' => &$this, 'authorid' => &$authorid, 'timestamp' => &$timestamp, 'closed' => &$closed, 'draft' => &$draft, 'catid' => &$catid));
+
+               $title = addslashes($title);
+               $body = addslashes($body);
+               $more = addslashes($more);
+
+               $query = 'INSERT INTO '.sql_table('item').' (ITITLE, IBODY, IMORE, IBLOG, IAUTHOR, ITIME, ICLOSED, IDRAFT, ICAT) '
+                          . "VALUES ('$title', '$body', '$more', $blogid, $authorid, '$timestamp', $closed, $draft, $catid)";
+               sql_query($query);
+               $itemid = mysql_insert_id();
+
+               $manager->notify('PostAddItem',array('itemid' => $itemid));
+
+               if (!$draft)
+                       $this->updateUpdateFile();
+
+               // send notification mail
+               if (!$draft && !$isFuture && $this->getNotifyAddress() && $this->notifyOnNewItem())
+                       $this->sendNewItemNotification($itemid, stripslashes($title), stripslashes($body));
+
+               return $itemid;
+       }
+
+       function sendNewItemNotification($itemid, $title, $body) {
+               global $CONF, $member;
+
+               // create text version of html post
+               $ascii = toAscii($body);
+
+               $mailto_msg = _NOTIFY_NI_MSG . " \n";
+               $mailto_msg .= $CONF['IndexURL'] . 'index.php?itemid=' . $itemid . "\n\n";
+               $mailto_msg .= _NOTIFY_TITLE . ' ' . strip_tags($title) . "\n";
+               $mailto_msg .= _NOTIFY_CONTENTS . "\n " . $ascii . "\n";
+               $mailto_msg .= getMailFooter();
+
+               $mailto_title = $this->getName() . ': ' . _NOTIFY_NI_TITLE;
+
+               $frommail = $member->getNotifyFromMailAddress();
+
+               $notify =& new NOTIFICATION($this->getNotifyAddress());
+               $notify->notify($mailto_title, $mailto_msg , $frommail);
+
+
+
+       }
+
+
+       /**
+         * Creates a new category for this blog
+         *
+         * @param $catName
+         *             name of the new category. When empty, a name is generated automatically
+         *             (starting with newcat)
+         * @param $catDescription
+         *             description of the new category. Defaults to 'New Category'
+         *
+         * @returns
+         *             the new category-id in case of success.
+         *             0 on failure
+         */
+       function createNewCategory($catName = '', $catDescription = 'New category') {
+               global $member, $manager;
+
+               if ($member->blogAdminRights($this->getID())) {
+                       // generate
+                       if ($catName == '')
+                       {
+                               $catName = 'newcat';
+                               $i = 1;
+
+                               $res = sql_query('SELECT * FROM '.sql_table('category')." WHERE cname='".$catName.$i."' and cblog=".$this->getID());
+                               while (mysql_num_rows($res) > 0)
+                               {
+                                       $i++;
+                                       $res = sql_query('SELECT * FROM '.sql_table('category')." WHERE cname='".$catName.$i."' and cblog=".$this->getID());
+                               }
+
+                               $catName = $catName . $i;
+                       }
+
+                       $manager->notify(
+                               'PreAddCategory',
+                               array(
+                                       'blog' => &$this,
+                                       'name' => &$catName,
+                                       'description' => $catDescription
+                               )
+                       );
+
+                       $query = 'INSERT INTO '.sql_table('category').' (cblog, cname, cdesc) VALUES (' . $this->getID() . ", '" . addslashes($catName) . "', '" . addslashes($catDescription) . "')";
+                       sql_query($query);
+                       $catid = mysql_insert_id();
+
+                       $manager->notify(
+                               'PostAddCategory',
+                               array(
+                                       'blog' => &$this,
+                                       'name' => $catName,
+                                       'description' => $catDescription,
+                                       'catid' => $catid
+                               )
+                       );
+
+                       return $catid;
+               } else {
+                       return 0;
+               }
+
+       }
+
+
+       /**
+        * Searches all months of this blog for the given query
+        *
+        * @param $query
+        *              search query
+        * @param $template
+        *              template to be used (__NAME__ of the template)
+        * @param $amountMonths
+        *              max amount of months to be search (0 = all)
+        * @param $maxresults
+        *              max number of results to show
+        * @param $startpos
+        *              offset
+        * @returns
+        *              amount of hits found
+        */
+       function search($query, $template, $amountMonths, $maxresults, $startpos) {
+               global $CONF, $manager;
+
+               $highlight      = '';
+               $sqlquery       = $this->getSqlSearch($query, $amountMonths, $highlight);
+
+               if ($sqlquery == '')
+               {
+                       // no query -> show everything
+                       $extraquery = '';
+                       $amountfound = $this->readLogAmount($template, $maxresults, $extraQuery, $query, 1, 1);
+               } else {
+
+                       // add LIMIT to query (to split search results into pages)
+                       if (intval($maxresults > 0))
+                               $sqlquery .= ' LIMIT ' . intval($startpos).',' . intval($maxresults);
+
+                       // show results
+                       $amountfound = $this->showUsingQuery($template, $sqlquery, $highlight, 1, 1);
+
+                       // when no results were found, show a message
+                       if ($amountfound == 0)
+                       {
+                               $template =& $manager->getTemplate($template);
+                               $vars = array(
+                                       'query'         => htmlspecialchars($query),
+                                       'blogid'        => $this->getID()
+                               );
+                               echo TEMPLATE::fill($template['SEARCH_NOTHINGFOUND'],$vars);
+                       }
+               }
+
+               return $amountfound;
+       }
+
+       /**
+        * Returns an SQL query to use for a search query
+        *
+        * @param $query
+        *              search query
+        * @param $amountMonths
+        *              amount of months to search back. Default = 0 = unlimited
+        * @param $mode
+        *              either empty, or 'count'. In this case, the query will be a SELECT COUNT(*) query
+        * @returns $highlight
+        *              words to highlight (out parameter)
+        * @returns
+        *              either a full SQL query, or an empty string (if querystring empty)
+        * @note
+        *              No LIMIT clause is added. (caller should add this if multiple pages are requested)
+        */
+       function getSqlSearch($query, $amountMonths = 0, &$highlight, $mode = '')
+       {
+               $searchclass =& new SEARCH($query);
+
+               $highlight        = $searchclass->inclusive;
+
+               // if querystring is empty, return empty string
+               if ($searchclass->inclusive == '')
+                       return '';
+
+
+               $where  = $searchclass->boolean_sql_where('ititle,ibody,imore');
+               $select = $searchclass->boolean_sql_select('ititle,ibody,imore');
+
+               // get list of blogs to search
+               $blogs          = $searchclass->blogs;          // array containing blogs that always need to be included
+               $blogs[]        = $this->getID();                       // also search current blog (duh)
+               $blogs          = array_unique($blogs);         // remove duplicates
+               $selectblogs = '';
+               if (count($blogs) > 0)
+                       $selectblogs = ' and i.iblog in (' . implode(',', $blogs) . ')';
+
+               if ($mode == '')
+               {
+                       $query = 'SELECT i.inumber as itemid, i.ititle as title, i.ibody as body, m.mname as author, m.mrealname as authorname, i.itime, i.imore as more, m.mnumber as authorid, m.memail as authormail, m.murl as authorurl, c.cname as category, i.icat as catid, i.iclosed as closed';
+                       if ($select)
+                               $query .= ', '.$select. ' as score ';
+               } else {
+                       $query = 'SELECT COUNT(*) as result ';
+               }
+
+               $query .= ' FROM '.sql_table('item').' as i, '.sql_table('member').' as m, '.sql_table('category').' as c'
+                          . ' WHERE i.iauthor=m.mnumber'
+                          . ' and i.icat=c.catid'
+                          . ' and i.idraft=0'  // exclude drafts
+                          . $selectblogs
+                                       // don't show future items
+                          . ' and i.itime<=' . mysqldate($this->getCorrectTime())
+                          . ' and '.$where;
+
+               // take into account amount of months to search
+               if ($amountMonths > 0)
+               {
+                       $localtime = getdate($this->getCorrectTime());
+                       $timestamp_start = mktime(0,0,0,$localtime['mon'] - $amountMonths,1,$localtime['year']);
+                       $query .= ' and i.itime>' . mysqldate($timestamp_start);
+               }
+
+               if ($mode == '')
+               {
+                       if ($select)
+                               $query .= ' ORDER BY score DESC';
+                       else
+                               $query .= ' ORDER BY i.itime DESC ';
+               }
+
+               return $query;
+       }
+
+       /**
+        * Returns the SQL query that's normally used to display the blog items on the index type skins
+        *
+        * @param $mode
+        *              either empty, or 'count'. In this case, the query will be a SELECT COUNT(*) query
+        * @returns
+        *              either a full SQL query, or an empty string
+        * @note
+        *              No LIMIT clause is added. (caller should add this if multiple pages are requested)
+        */
+       function getSqlBlog($extraQuery, $mode = '')
+       {
+               if ($mode == '')
+                       $query = 'SELECT i.inumber as itemid, i.ititle as title, i.ibody as body, m.mname as author, m.mrealname as authorname, i.itime, i.imore as more, m.mnumber as authorid, m.memail as authormail, m.murl as authorurl, c.cname as category, i.icat as catid, i.iclosed as closed';
+               else
+                       $query = 'SELECT COUNT(*) as result ';
+
+               $query .= ' FROM '.sql_table('item').' as i, '.sql_table('member').' as m, '.sql_table('category').' as c'
+                          . ' WHERE i.iblog='.$this->blogid
+                          . ' and i.iauthor=m.mnumber'
+                          . ' and i.icat=c.catid'
+                          . ' and i.idraft=0'  // exclude drafts
+                                       // don't show future items
+                          . ' and i.itime<=' . mysqldate($this->getCorrectTime());
+
+               if ($this->getSelectedCategory())
+                       $query .= ' and i.icat=' . $this->getSelectedCategory() . ' ';
+
+
+               $query .= $extraQuery;
+
+               if ($mode == '')
+                       $query .= ' ORDER BY i.itime DESC';
+
+               return $query;
+       }
+
+       /**
+         * Shows the archivelist using the given template
+         */
+       function showArchiveList($template, $mode = 'month', $limit = 0) {
+               global $CONF, $catid, $manager;
+
+               if ($catid)
+                       $linkparams = array('catid' => $catid);
+
+               $template =& $manager->getTemplate($template);
+               $data['blogid'] = $this->getID();
+
+               echo TEMPLATE::fill($template['ARCHIVELIST_HEADER'],$data);
+
+               $query = 'SELECT itime, SUBSTRING(itime,1,4) AS Year, SUBSTRING(itime,6,2) AS Month, SUBSTRING(itime,9,2) as Day FROM '.sql_table('item')
+               . ' WHERE iblog=' . $this->getID()
+               . ' and itime <=' . mysqldate($this->getCorrectTime())  // don't show future items!
+               . ' and idraft=0'; // don't show draft items
+
+               if ($catid)
+                       $query .= ' and icat=' . intval($catid);
+
+               $query .= ' GROUP BY Year, Month';
+               if ($mode == 'day')
+                       $query .= ', Day';
+
+
+               $query .= ' ORDER BY itime DESC';
+
+               if ($limit > 0)
+                       $query .= ' LIMIT ' . intval($limit);
+
+               $res = sql_query($query);
+
+               while ($current = mysql_fetch_object($res)) {
+                       $current->itime = strtotime($current->itime);   // string time -> unix timestamp
+
+                       if ($mode == 'day') {
+                               $archivedate = date('Y-m-d',$current->itime);
+                               $archive['day'] = date('d',$current->itime);
+                       } else {
+                               $archivedate = date('Y-m',$current->itime);
+                       }
+                       $data['month'] = date('m',$current->itime);
+                       $data['year'] = date('Y',$current->itime);
+                       $data['archivelink'] = createArchiveLink($this->getID(),$archivedate,$linkparams);
+
+                       $temp = TEMPLATE::fill($template['ARCHIVELIST_LISTITEM'],$data);
+                       echo strftime($temp,$current->itime);
+
+               }
+
+               mysql_free_result($res);
+
+               echo TEMPLATE::fill($template['ARCHIVELIST_FOOTER'],$data);
+       }
+
+
+       /**
+         * Shows the list of categories using a given template
+         */
+       function showCategoryList($template) {
+               global $CONF, $manager;
+
+               // determine arguments next to catids
+               // I guess this can be done in a better way, but it works
+               global $archive, $archivelist;
+
+               $linkparams = array();
+               if ($archive) {
+                       $blogurl = createArchiveLink($this->getID(), $archive, '');
+                       $linkparams['blogid'] = $this->getID();
+                       $linkparams['archive'] = $archive;
+               } else if ($archivelist) {
+                       $blogurl = createArchiveListLink($this->getID(), '');
+                       $linkparams['archivelist'] = $archivelist;
+               } else {
+                       $blogurl = createBlogidLink($this->getID(), '');
+                       $linkparams['blogid'] = $this->getID();
+               }
+
+               //$blogurl = $this->getURL() . $qargs;
+               $blogurl = createBlogLink($this->getURL(), $linkparams);
+
+               $template =& $manager->getTemplate($template);
+
+               echo TEMPLATE::fill((isset($template['CATLIST_HEADER']) ? $template['CATLIST_HEADER'] : null),
+                                                       array(
+                                                               'blogid' => $this->getID(),
+                                                               'blogurl' => $blogurl,
+                                                               'self' => $CONF['Self']
+                                                       ));
+
+               $query = 'SELECT catid, cdesc as catdesc, cname as catname FROM '.sql_table('category').' WHERE cblog=' . $this->getID() . ' ORDER BY cname ASC';
+               $res = sql_query($query);
+
+
+               while ($data = mysql_fetch_assoc($res)) {
+                       $data['blogid'] = $this->getID();
+                       $data['blogurl'] = $blogurl;
+                       $data['catlink'] = createLink(
+                                                               'category',
+                                                               array(
+                                                                       'catid' => $data['catid'],
+                                                                       'name' => $data['catname'],
+                                                                       'extra' => $linkparams
+                                                               )
+                                                          );
+                       $data['self'] = $CONF['Self'];
+
+                       echo TEMPLATE::fill((isset($template['CATLIST_LISTITEM']) ? $template['CATLIST_LISTITEM'] : null), $data);
+                       //$temp = TEMPLATE::fill((isset($template['CATLIST_LISTITEM']) ? $template['CATLIST_LISTITEM'] : null), $data);
+                       //echo strftime($temp, $current->itime);
+
+               }
+
+               mysql_free_result($res);
+
+               echo TEMPLATE::fill((isset($template['CATLIST_FOOTER']) ? $template['CATLIST_FOOTER'] : null),
+                                                       array(
+                                                               'blogid' => $this->getID(),
+                                                               'blogurl' => $blogurl,
+                                                               'self' => $CONF['Self']
+                                                       ));
+       }
+
+       /**
+         * Blogsettings functions
+         */
+
+       function readSettings() {
+               $query =  'SELECT *'
+                          . ' FROM '.sql_table('blog')
+                          . ' WHERE bnumber=' . $this->blogid;
+               $res = sql_query($query);
+
+               $this->isValid = (mysql_num_rows($res) > 0);
+               if (!$this->isValid)
+                       return;
+
+               $this->settings = mysql_fetch_assoc($res);
+       }
+
+       function writeSettings() {
+
+               // (can't use floatval since not available prior to PHP 4.2)
+               $offset = $this->getTimeOffset();
+               if (!is_float($offset))
+                       $offset = intval($offset);
+
+               $query =  'UPDATE '.sql_table('blog')
+                          . " SET bname='" . addslashes($this->getName()) . "',"
+                          . "     bshortname='". addslashes($this->getShortName()) . "',"
+                          . "     bcomments=". intval($this->commentsEnabled()) . ","
+                          . "     bmaxcomments=" . intval($this->getMaxComments()) . ","
+                          . "     btimeoffset=" . $offset . ","
+                          . "     bpublic=" . intval($this->isPublic()) . ","
+                          . "     breqemail=" . intval($this->emailRequired()) . ","
+                          . "     bsendping=" . intval($this->pingUserland()) . ","
+                          . "     bconvertbreaks=" . intval($this->convertBreaks()) . ","
+                          . "     ballowpast=" . intval($this->allowPastPosting()) . ","
+                          . "     bnotify='" . addslashes($this->getNotifyAddress()) . "',"
+                          . "     bnotifytype=" . intval($this->getNotifyType()) . ","
+                          . "     burl='" . addslashes($this->getURL()) . "',"
+                          . "     bupdate='" . addslashes($this->getUpdateFile()) . "',"
+                          . "     bdesc='" . addslashes($this->getDescription()) . "',"
+                          . "     bdefcat=" . intval($this->getDefaultCategory()) . ","
+                          . "     bdefskin=" . intval($this->getDefaultSkin()) . ","
+                          . "     bincludesearch=" . intval($this->getSearchable())
+                          . " WHERE bnumber=" . intval($this->getID());
+               sql_query($query);
+
+       }
+
+
+
+       // update update file if requested
+       function updateUpdatefile() {
+                if ($this->getUpdateFile()) {
+                       $f_update = fopen($this->getUpdateFile(),'w');
+                       fputs($f_update,$this->getCorrectTime());
+                       fclose($f_update);
+                }
+
+       }
+
+       /**
+         * Sends a XML-RPC ping message to Userland, so the weblog can
+         * show up in the weblogs.com updates-list
+         */
+       function sendUserlandPing() {
+               global $php_errormsg;
+
+                if ($this->pingUserland()) {
+                         // testmessage for adding an item
+                         $message = new xmlrpcmsg('weblogUpdates.ping',array(
+                                       new xmlrpcval($this->getName(),'string'),
+                                       new xmlrpcval($this->getURL(),'string')
+                         ));
+
+                         $c = new xmlrpc_client('/RPC2', 'rpc.weblogs.com', 80);
+
+                         // $c->setDebug(1);
+
+                         $r = $c->send($message,15); // 15 seconds timeout...
+
+                         if (($r == 0) && ($r->errno || $r->errstring)) {
+                               return 'Error ' . $r->errno . ' : ' . $r->errstring;
+                         } elseif (($r == 0) && ($php_errormsg)) {
+                               return 'PHP Error: ' . $php_errormsg;
+                         } elseif ($r == 0) {
+                               return 'Error while trying to send ping. Sorry about that.';
+                         } elseif ($r->faultCode() != 0) {
+                               return 'Error: ' . $r->faultString();
+                         } else {
+                                 $r = $r->value();     // get response struct
+                                 // get values
+                                 $flerror = $r->structmem('flerror');
+                                 $flerror = $flerror->scalarval();
+
+
+                                 $message = $r->structmem('message');
+                                 $message = $message->scalarval();
+
+                                 if ($flerror != 0)
+                                       return 'Error (flerror=1): ' . $message;
+                                 else
+                                       return 'Success: ' . $message;
+                         }
+                }
+       }
+
+       function isValidCategory($catid) {
+               $query = 'SELECT * FROM '.sql_table('category').' WHERE cblog=' . $this->getID() . ' and catid=' . intval($catid);
+               $res = mysql_query($query);
+               return (mysql_num_rows($res) != 0);
+       }
+
+       function getCategoryName($catid) {
+               $res = mysql_query('SELECT cname FROM '.sql_table('category').' WHERE cblog='.$this->getID().' and catid=' . intval($catid));
+               $o = mysql_fetch_object($res);
+               return $o->cname;
+       }
+
+       function getCategoryDesc($catid) {
+               $res = mysql_query('SELECT cdesc FROM '.sql_table('category').' WHERE cblog='.$this->getID().' and catid=' . intval($catid));
+               $o = mysql_fetch_object($res);
+               return $o->cdesc;
+       }
+
+       function getCategoryIdFromName($name) {
+               $res = mysql_query('SELECT catid FROM '.sql_table('category').' WHERE cblog='.$this->getID().' and cname="' . addslashes($name) . '"');
+               if (mysql_num_rows($res) > 0) {
+                       $o = mysql_fetch_object($res);
+                       return $o->catid;
+               } else {
+                       return $this->getDefaultCategory();
+               }
+       }
+
+       function pingUserland() {
+               return $this->getSetting('bsendping');
+       }
+
+       function setPingUserland($val) {
+               $this->setSetting('bsendping',$val);
+       }
+
+       function convertBreaks() {
+               return $this->getSetting('bconvertbreaks');
+       }
+
+       function insertJavaScriptInfo($authorid = '') {
+               global $member, $CONF;
+
+               if ($authorid == '')
+                       $authorid = $member->getID();
+
+               ?>
+               <script type="text/javascript">
+                       setConvertBreaks(<?php echo  $this->convertBreaks() ? 'true' : 'false' ?>);
+                       setMediaUrl("<?php echo $CONF['MediaURL']?>");
+                       setAuthorId(<?php echo $authorid?>);
+               </script><?php  }
+
+       function setConvertBreaks($val) {
+               $this->setSetting('bconvertbreaks',$val);
+       }
+       function setAllowPastPosting($val) {
+               $this->setSetting('ballowpast',$val);
+       }
+       function allowPastPosting() {
+               return $this->getSetting('ballowpast');
+       }
+
+       function getCorrectTime($t=0) {
+               if ($t == 0) $t = time();
+               return ($t + 3600 * $this->getTimeOffset());
+       }
+
+       function getName() {
+               return $this->getSetting('bname');
+       }
+
+       function getShortName() {
+               return $this->getSetting('bshortname');
+       }
+
+       function getMaxComments() {
+               return $this->getSetting('bmaxcomments');
+       }
+
+       function getNotifyAddress() {
+               return $this->getSetting('bnotify');
+       }
+
+       function getNotifyType() {
+               return $this->getSetting('bnotifytype');
+       }
+
+       function notifyOnComment() {
+               $n = $this->getNotifyType();
+               return (($n != 0) && (($n % 3) == 0));
+       }
+
+       function notifyOnVote() {
+               $n = $this->getNotifyType();
+               return (($n != 0) && (($n % 5) == 0));
+       }
+
+       function notifyOnNewItem() {
+               $n = $this->getNotifyType();
+               return (($n != 0) && (($n % 7) == 0));
+       }
+
+       function setNotifyType($val) {
+               $this->setSetting('bnotifytype',$val);
+       }
+
+
+       function getTimeOffset() {
+               return $this->getSetting('btimeoffset');
+       }
+
+       function commentsEnabled() {
+               return $this->getSetting('bcomments');
+       }
+
+       function getURL() {
+               return $this->getSetting('burl');
+       }
+
+       function getDefaultSkin() {
+               return $this->getSetting('bdefskin');
+       }
+
+       function getUpdateFile() {
+               return $this->getSetting('bupdate');
+       }
+
+       function getDescription() {
+               return $this->getSetting('bdesc');
+       }
+
+       function isPublic() {
+               return $this->getSetting('bpublic');
+       }
+
+       function emailRequired() {
+               return $this->getSetting('breqemail');
+       }
+
+       function getSearchable() {
+               return $this->getSetting('bincludesearch');
+       }
+
+       function getDefaultCategory() {
+               return $this->getSetting('bdefcat');
+       }
+
+       function setPublic($val) {
+               $this->setSetting('bpublic',$val);
+       }
+
+       function setSearchable($val) {
+               $this->setSetting('bincludesearch',$val);
+       }
+
+       function setDescription($val) {
+               $this->setSetting('bdesc',$val);
+       }
+
+       function setUpdateFile($val) {
+               $this->setSetting('bupdate',$val);
+       }
+
+       function setDefaultSkin($val) {
+               $this->setSetting('bdefskin',$val);
+       }
+
+       function setURL($val) {
+               $this->setSetting('burl',$val);
+       }
+
+       function setName($val) {
+               $this->setSetting('bname',$val);
+       }
+
+       function setShortName($val) {
+               $this->setSetting('bshortname',$val);
+       }
+
+       function setCommentsEnabled($val) {
+               $this->setSetting('bcomments',$val);
+       }
+
+       function setMaxComments($val) {
+               $this->setSetting('bmaxcomments',$val);
+       }
+
+       function setNotifyAddress($val) {
+               $this->setSetting('bnotify',$val);
+       }
+
+       function setEmailRequired($val) {
+               $this->setSetting('breqemail',$val);
+       }
+
+       function setTimeOffset($val) {
+               // check validity of value
+               // 1. replace , by . (common mistake)
+               $val = str_replace(',','.',$val);
+               // 2. cast to float or int
+               if (is_numeric($val) && strstr($val,'.5')) {
+                       $val = (float) $val;
+               } else {
+                       $val = intval($val);
+               }
+
+               $this->setSetting('btimeoffset',$val);
+       }
+
+       function setDefaultCategory($val) {
+               $this->setSetting('bdefcat',$val);
+       }
+
+       function getSetting($key) {
+               return $this->settings[$key];
+       }
+
+       function setSetting($key,$value) {
+               $this->settings[$key] = $value;
+       }
+
+
+       // tries to add a member to the team. Returns false if the member was already on
+       // the team
+       function addTeamMember($memberid, $admin) {
+               global $manager;
+
+               $memberid = intval($memberid);
+               $admin = intval($admin);
+
+               // check if member is already a member
+               $tmem = MEMBER::createFromID($memberid);
+
+               if ($tmem->isTeamMember($this->getID()))
+                       return 0;
+
+               $manager->notify(
+                       'PreAddTeamMember',
+                       array(
+                               'blog' => &$this,
+                               'member' => &$tmem,
+                               'admin' => &$admin
+                       )
+               );
+
+               // add to team
+               $query = 'INSERT INTO '.sql_table('team').' (TMEMBER, TBLOG, TADMIN) '
+                          . 'VALUES (' . $memberid .', '.$this->getID().', "'.$admin.'")';
+               sql_query($query);
+
+               $manager->notify(
+                       'PostAddTeamMember',
+                       array(
+                               'blog' => &$this,
+                               'member' => &$tmem,
+                               'admin' => $admin
+                       )
+
+               );
+
+               ACTIONLOG::add(INFO, 'Added ' . $tmem->getDisplayName() . ' (ID=' .
+                                          $memberid .') to the team of blog "' . $this->getName() . '"');
+
+               return 1;
+       }
+
+       function getID() {
+               return $this->blogid;
+       }
+
+       // returns true if there is a blog with the given shortname (static)
+       function exists($name) {
+               $r = sql_query('select * FROM '.sql_table('blog').' WHERE bshortname="'.addslashes($name).'"');
+               return (mysql_num_rows($r) != 0);
+       }
+
+       // returns true if there is a blog with the given ID (static)
+       function existsID($id) {
+               $r = sql_query('select * FROM '.sql_table('blog').' WHERE bnumber='.intval($id));
+               return (mysql_num_rows($r) != 0);
+       }
+
+
+}
+
+?>
index 9d33b80..f54367f 100755 (executable)
-<?php\r
-\r
-/**\r
-  * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
-  * Copyright (C) 2002-2005 The Nucleus Group\r
-  *\r
-  * This program is free software; you can redistribute it and/or\r
-  * modify it under the terms of the GNU General Public License\r
-  * as published by the Free Software Foundation; either version 2\r
-  * of the License, or (at your option) any later version.\r
-  * (see nucleus/documentation/index.html#license for more info)\r
-  *\r
-  * A class representing a single comment\r
-  *\r
-  * $Id: COMMENT.php,v 1.3 2005-03-12 06:19:05 kimitake Exp $\r
-  * $NucleusJP$\r
-  */\r
-class COMMENT {\r
-\r
-       /**\r
-         * Returns the requested comment (static)\r
-         */\r
-       function getComment($commentid) {\r
-               $query =  'SELECT cnumber as commentid, cbody as body, cuser as user, cmail as userid, cmember as memberid, ctime, chost as host, mname as member, cip as ip, cblog as blogid'\r
-                          . ' FROM '.sql_table('comment').' left outer join '.sql_table('member').' on cmember=mnumber'\r
-                          . ' WHERE cnumber=' . intval($commentid);\r
-               $comments = sql_query($query);\r
-\r
-               $aCommentInfo = mysql_fetch_assoc($comments);\r
-               if ($aCommentInfo)\r
-               {\r
-                       $aCommentInfo['timestamp'] = strtotime($aCommentInfo['ctime']);\r
-               }\r
-               return $aCommentInfo;\r
-       }\r
-\r
-       /**\r
-         * prepares a comment to be saved\r
-         * (static)\r
-         */\r
-       function prepare($comment) {\r
-               $comment['user'] = strip_tags($comment['user']);\r
-               $comment['userid'] = strip_tags($comment['userid']);\r
-\r
-               // remove quotes and newlines from user and userid\r
-               $comment['user'] = strtr($comment['user'], "\'\"\n",'-- ');\r
-               $comment['userid'] = strtr($comment['userid'], "\'\"\n",'-- ');\r
-\r
-               $comment['body'] = COMMENT::prepareBody($comment['body']);\r
-\r
-               return $comment;\r
-       }\r
-\r
-       // prepares the body of a comment (static)\r
-       function prepareBody($body) {\r
-\r
-               // remove newlines when too many in a row\r
-               $body = ereg_replace("\n.\n.\n","\n",$body);\r
-\r
-               // encode special characters as entities\r
-               $body = htmlspecialchars($body);\r
-\r
-               // trim away whitespace and newlines at beginning and end\r
-               $body = trim($body);\r
-\r
-               // add <br /> tags\r
-               $body = addBreaks($body);\r
-\r
-               // create hyperlinks for http:// addresses\r
-               // there's a testcase for this in /build/testcases/urllinking.txt\r
-               $replaceFrom = array(\r
-                       '/([^:\/\/\w]|^)((https:\/\/)([a-z0-9_\.-]+)([\/a-z0-9_+\.~%&?@=_:;#,-]+))/ie',\r
-                       '/([^:\/\/\w]|^)((http:\/\/|www\.)([a-z0-9_\.-]+)([\/a-z0-9_+\.~%&?@=_:;#,-]+))/ie',\r
-                       '/([^:\/\/\w]|^)((ftp:\/\/|ftp\.)([a-z0-9_\.-]+)([\/a-z0-9_+\.~%&?@=_:;#,-]+))/ie',\r
-                       '/([^:\/\/\w]|^)(mailto:(([a-zA-Z\@\%\.\-\+_])+))/ie'\r
-               );\r
-               $replaceTo = array(\r
-                       'COMMENT::createLinkCode("\\1", "\\2","https")',\r
-                       'COMMENT::createLinkCode("\\1", "\\2","http")',\r
-                       'COMMENT::createLinkCode("\\1", "\\2","ftp")',\r
-                       'COMMENT::createLinkCode("\\1", "\\3","mailto")'\r
-               );\r
-               $body = preg_replace($replaceFrom, $replaceTo, $body);\r
-\r
-               return $body;\r
-       }\r
-\r
-       function createLinkCode($pre, $url, $protocol = 'http') {\r
-               $post = '';\r
-\r
-               // it's possible that $url ends contains entities we don't want,\r
-               // since htmlspecialchars is applied _before_ URL linking\r
-               // move the part of URL, starting from the disallowed entity to the 'post' link part\r
-               $aBadEntities = array('&quot;', '&gt;', '&lt;');\r
-               foreach ($aBadEntities as $entity)\r
-               {\r
-                       $pos = strpos($url, $entity);\r
-                       if ($pos)\r
-                       {\r
-                               $post = substr($url, $pos) . $post;\r
-                               $url = substr($url, 0, $pos);\r
-\r
-                       }\r
-               }\r
-\r
-               // remove entities at end (&&&&)\r
-               if (preg_match('/(&\w+;)+$/i', $url, $matches)) {\r
-                       $post = $matches[0] . $post;    // found entities (1 or more)\r
-                       $url = substr($url, 0, strlen($url) - strlen($post));\r
-               }\r
-\r
-               // move ending comma from url to 'post' part\r
-               if (substr($url, strlen($url) - 1) == ',')\r
-               {\r
-                       $url = substr($url, 0, strlen($url) - 1);\r
-                       $post = ',' . $post;\r
-               }\r
-\r
-               if (!ereg('^'.$protocol.'://',$url))\r
-                       $linkedUrl = $protocol . (($protocol == 'mailto') ? ':' : '://') . $url;\r
-               else\r
-                       $linkedUrl = $url;\r
-\r
-\r
-               if ($protocol != 'mailto')\r
-                       $displayedUrl = $linkedUrl;\r
-               else\r
-                       $displayedUrl = $url;\r
-               return $pre . '<a href="'.$linkedUrl.'" rel="nofollow">'.shorten($displayedUrl,30,'...').'</a>' . $post;\r
-       }\r
-\r
-}\r
-\r
-?>\r
+<?php
+
+/*
+ * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
+ * Copyright (C) 2002-2006 The Nucleus Group
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * (see nucleus/documentation/index.html#license for more info)
+ */
+/**
+ * A class representing a single comment
+ *
+ * @license http://nucleuscms.org/license.txt GNU General Public License
+ * @copyright Copyright (C) 2002-2006 The Nucleus Group
+ * @version $Id: COMMENT.php,v 1.4 2006-07-17 20:03:44 kimitake Exp $
+ * $NucleusJP: COMMENT.php,v 1.3 2005/03/12 06:19:05 kimitake Exp $
+ */
+class COMMENT {
+
+       /**
+         * Returns the requested comment (static)
+         */
+       function getComment($commentid) {
+               $query =  'SELECT cnumber as commentid, cbody as body, cuser as user, cmail as userid, cemail as email, cmember as memberid, ctime, chost as host, mname as member, cip as ip, cblog as blogid'
+                          . ' FROM '.sql_table('comment').' left outer join '.sql_table('member').' on cmember=mnumber'
+                          . ' WHERE cnumber=' . intval($commentid);
+               $comments = sql_query($query);
+
+               $aCommentInfo = mysql_fetch_assoc($comments);
+               if ($aCommentInfo)
+               {
+                       $aCommentInfo['timestamp'] = strtotime($aCommentInfo['ctime']);
+               }
+               return $aCommentInfo;
+       }
+
+       /**
+         * prepares a comment to be saved
+         * (static)
+         */
+       function prepare($comment) {
+               $comment['user'] = strip_tags($comment['user']);
+               $comment['userid'] = strip_tags($comment['userid']);
+               $comment['email'] = strip_tags($comment['email']);
+
+               // remove quotes and newlines from user and userid
+               $comment['user'] = strtr($comment['user'], "\'\"\n",'-- ');
+               $comment['userid'] = strtr($comment['userid'], "\'\"\n",'-- ');
+               $comment['email'] = strtr($comment['email'], "\'\"\n",'-- ');
+
+               $comment['body'] = COMMENT::prepareBody($comment['body']);
+
+               return $comment;
+       }
+
+       // prepares the body of a comment (static)
+       function prepareBody($body) {
+
+               // remove newlines when too many in a row
+               $body = ereg_replace("\n.\n.\n","\n",$body);
+
+               // encode special characters as entities
+               $body = htmlspecialchars($body);
+
+               // trim away whitespace and newlines at beginning and end
+               $body = trim($body);
+
+               // add <br /> tags
+               $body = addBreaks($body);
+
+               // create hyperlinks for http:// addresses
+               // there's a testcase for this in /build/testcases/urllinking.txt
+               $replaceFrom = array(
+                       '/([^:\/\/\w]|^)((https:\/\/)([\w\.-]+)([\/\w+\.~%&?@=_:;#,-]+))/ie',
+                       '/([^:\/\/\w]|^)((http:\/\/|www\.)([\w\.-]+)([\/\w+\.~%&?@=_:;#,-]+))/ie',
+                       '/([^:\/\/\w]|^)((ftp:\/\/|ftp\.)([\w\.-]+)([\/\w+\.~%&?@=_:;#,-]+))/ie',
+                       '/([^:\/\/\w]|^)(mailto:(([a-zA-Z\@\%\.\-\+_])+))/ie'
+               );
+               $replaceTo = array(
+                       'COMMENT::createLinkCode("\\1", "\\2","https")',
+                       'COMMENT::createLinkCode("\\1", "\\2","http")',
+                       'COMMENT::createLinkCode("\\1", "\\2","ftp")',
+                       'COMMENT::createLinkCode("\\1", "\\3","mailto")'
+               );
+               $body = preg_replace($replaceFrom, $replaceTo, $body);
+
+               return $body;
+       }
+
+       function createLinkCode($pre, $url, $protocol = 'http') {
+               $post = '';
+
+               // it's possible that $url ends contains entities we don't want,
+               // since htmlspecialchars is applied _before_ URL linking
+               // move the part of URL, starting from the disallowed entity to the 'post' link part
+               $aBadEntities = array('&quot;', '&gt;', '&lt;');
+               foreach ($aBadEntities as $entity)
+               {
+                       $pos = strpos($url, $entity);
+                       if ($pos)
+                       {
+                               $post = substr($url, $pos) . $post;
+                               $url = substr($url, 0, $pos);
+
+                       }
+               }
+
+               // remove entities at end (&&&&)
+               if (preg_match('/(&\w+;)+$/i', $url, $matches)) {
+                       $post = $matches[0] . $post;    // found entities (1 or more)
+                       $url = substr($url, 0, strlen($url) - strlen($post));
+               }
+
+               // move ending comma from url to 'post' part
+               if (substr($url, strlen($url) - 1) == ',')
+               {
+                       $url = substr($url, 0, strlen($url) - 1);
+                       $post = ',' . $post;
+               }
+
+               if (!ereg('^'.$protocol.'://',$url))
+                       $linkedUrl = $protocol . (($protocol == 'mailto') ? ':' : '://') . $url;
+               else
+                       $linkedUrl = $url;
+
+
+               if ($protocol != 'mailto')
+                       $displayedUrl = $linkedUrl;
+               else
+                       $displayedUrl = $url;
+               return $pre . '<a href="'.$linkedUrl.'" rel="nofollow">'.shorten($displayedUrl,30,'...').'</a>' . $post;
+       }
+
+}
+
+?>
\ No newline at end of file
diff --git a/utf8/nucleus/libs/COMMENTACTIONS.php b/utf8/nucleus/libs/COMMENTACTIONS.php
new file mode 100644 (file)
index 0000000..d2a75db
--- /dev/null
@@ -0,0 +1,245 @@
+<?php
+/*
+ * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
+ * Copyright (C) 2002-2006 The Nucleus Group
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * (see nucleus/documentation/index.html#license for more info)
+ */
+
+/**
+  * This class is used when parsing comment templates
+  */
+class COMMENTACTIONS extends BaseActions {
+
+       // ref to COMMENTS object which is using this object to handle
+       // its templatevars
+       var $commentsObj;
+
+       // template to use to parse the comments
+       var $template;
+
+       // comment currenlty being handled (mysql result assoc array; see COMMENTS::showComments())
+       var $currentComment;
+
+       function COMMENTACTIONS(&$comments) {
+               // call constructor of superclass first
+               $this->BaseActions();
+
+               // reference to the comments object
+               $this->setCommentsObj($comments);
+       }
+
+       function getDefinedActions() {
+               return array(
+                       'blogurl',
+                       'commentcount',
+                       'commentword',
+                       'email',
+                       'itemlink',
+                       'itemid',
+                       'itemtitle',
+                       'date',
+                       'time',
+                       'commentid',
+                       'body',
+                       'memberid',
+                       'timestamp',
+                       'host',
+                       'ip',
+                       'blogid',
+                       'authtext',
+                       'user',
+                       'userid',
+                       'userlinkraw',
+                       'userlink',
+                       'useremail',
+                       'userwebsite',
+                       'excerpt',
+                       'short',
+                       'skinfile',
+                       'set',
+                       'plugin',
+                       'include',
+                       'phpinclude',
+                       'parsedinclude'
+               );
+       }
+
+       function setParser(&$parser) {                  $this->parser =& $parser; }
+       function setCommentsObj(&$commentsObj) {$this->commentsObj =& $commentsObj; }
+       function setTemplate($template) {               $this->template =& $template; }
+       function setCurrentComment(&$comment) {
+               global $manager;
+               if ($comment['memberid'] != 0) {
+                       $comment['authtext'] = $template['COMMENTS_AUTH'];
+
+                       $mem =& $manager->getMember($comment['memberid']);
+                       $comment['user'] = $mem->getDisplayName();
+                       if ($mem->getURL())
+                               $comment['userid'] = $mem->getURL();
+                       else
+                               $comment['userid'] = $mem->getEmail();
+
+                       $comment['userlinkraw'] = createLink(
+                                                                               'member',
+                                                                               array(
+                                                                                       'memberid' => $comment['memberid'],
+                                                                                       'name' => $mem->getDisplayName(),
+                                                                                       'extra' => $this->commentsObj->itemActions->linkparams
+                                                                               )
+                                                                         );
+
+               } else {
+
+                       // create smart links
+                       if (isValidMailAddress($comment['userid']))
+                               $comment['userlinkraw'] = 'mailto:'.$comment['userid'];
+                       elseif (strstr($comment['userid'],'http://') != false)
+                               $comment['userlinkraw'] = $comment['userid'];
+                       elseif (strstr($comment['userid'],'www') != false)
+                               $comment['userlinkraw'] = 'http://'.$comment['userid'];
+               }
+
+               $this->currentComment =& $comment;
+       }
+
+       function parse_blogurl() {
+               global $manager;
+               $blogid = getBlogIDFromItemID($this->commentsObj->itemid);
+               $blog =& $manager->getBlog($blogid);
+               echo $blog->getURL();
+       }
+
+       function parse_commentcount() {                 echo $this->commentsObj->commentcount; }
+       function parse_commentword() {
+               if ($this->commentsObj->commentcount == 1)
+                       echo $this->template['COMMENTS_ONE'];
+               else
+                       echo $this->template['COMMENTS_MANY'];
+       }
+
+       function parse_itemlink() {
+               echo createLink(
+                       'item',
+                       array(
+                               'itemid' => $this->commentsObj->itemid,
+                               'timestamp' => $this->commentsObj->itemActions->currentItem->timestamp,
+                               'title' => $this->commentsObj->itemActions->currentItem->title,
+                               'extra' => $this->commentsObj->itemActions->linkparams
+                       )
+               );
+       }
+       function parse_itemid() {                               echo $this->commentsObj->itemid; }
+       function parse_itemtitle($maxLength = 0) {
+               if ($maxLength == 0)
+                       $this->commentsObj->itemActions->parse_title();
+               else
+                       $this->commentsObj->itemActions->parse_syndicate_title($maxLength);
+       }
+
+       function parse_date($format = '') {
+               echo formatDate($format, $this->currentComment['timestamp'], $this->template['FORMAT_DATE'], $this->commentsObj->itemActions->blog);
+       }
+       function parse_time($format = '') {
+               echo strftime(
+                               ($format == '') ? $this->template['FORMAT_TIME'] : $format,
+                               $this->currentComment['timestamp']
+                       );
+       }
+
+       function parse_commentid() {                    echo $this->currentComment['commentid']; }
+       function parse_body() {                                 echo $this->highlight($this->currentComment['body']); }
+       function parse_memberid() {                             echo $this->currentComment['memberid']; }
+       function parse_timestamp() {                    echo $this->currentComment['timestamp']; }
+       function parse_host() {                                 echo $this->currentComment['host']; }
+       function parse_ip() {                                   echo $this->currentComment['ip']; }
+       function parse_blogid() {                               echo $this->currentComment['blogid']; }
+
+       function parse_user() {                                 echo $this->currentComment['user']; }
+       function parse_userid() {                               echo $this->currentComment['userid']; }
+       function parse_email() {
+               $email = $this->currentComment['email'];
+               $email = str_replace('@', ' (at) ', $email);
+               $email = str_replace('.', ' (dot) ', $email);
+               echo $email;
+       }
+       function parse_userlinkraw() {                  echo $this->currentComment['userlinkraw']; }
+       function parse_userlink() {
+               if ($this->currentComment['userlinkraw']) {
+                       echo '<a href="'.$this->currentComment['userlinkraw'].'" rel="nofollow">'.$this->currentComment['user'].'</a>';
+               } else {
+                       echo $this->currentComment['user'];
+               }
+       }
+
+       function parse_useremail() {
+               global $manager;
+               if ($this->currentComment['memberid'] > 0)
+               {
+                       $member =& $manager->getMember($this->currentComment['memberid']);
+
+                       if ($member->email != '')
+                               echo $member->email;
+               }
+               else
+               {
+                       if (!(strpos($this->currentComment['userlinkraw'], 'mailto:') === false))
+                               echo str_replace('mailto:', '', $this->currentComment['userlinkraw']);
+               }
+       }
+
+       function parse_userwebsite() {
+               if (!(strpos($this->currentComment['userlinkraw'], 'http://') === false))
+                       echo $this->currentComment['userlinkraw'];
+       }
+
+       function parse_excerpt() {
+               echo stringToXML(shorten($this->currentComment['body'], 60, '...'));
+       }
+       function parse_short() {
+               $tmp = strtok($this->currentComment['body'],"\n");
+               $tmp = str_replace('<br />','',$tmp);
+               echo $tmp;
+               if ($tmp != $this->currentComment['body'])
+                       $this->parser->parse($this->template['COMMENTS_CONTINUED']);
+       }
+       function parse_authtext() {
+               if ($this->currentComment['memberid'] != 0)
+                       $this->parser->parse($this->template['COMMENTS_AUTH']);
+       }
+
+       /**
+         * Executes a plugin templatevar
+         *
+         * @param pluginName name of plugin (without the NP_)
+         *
+         * extra parameters can be added
+         */
+       function parse_plugin($pluginName) {
+               global $manager;
+
+               // only continue when the plugin is really installed
+               if (!$manager->pluginInstalled('NP_' . $pluginName))
+                       return;
+
+               $plugin =& $manager->getPlugin('NP_' . $pluginName);
+               if (!$plugin) return;
+
+               // get arguments
+               $params = func_get_args();
+
+               // remove plugin name
+               array_shift($params);
+
+               // pass info on current item and current comment as well
+               $params = array_merge(array(&$this->currentComment),$params);
+               $params = array_merge(array(&$this->commentsObj->itemActions->currentItem),$params);
+
+               call_user_func_array(array(&$plugin,'doTemplateCommentsVar'), $params);
+       }
+}
+?>
index 200c435..01a0807 100755 (executable)
-<?php\r
-\r
-/**\r
-  * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
-  * Copyright (C) 2002-2005 The Nucleus Group\r
-  *\r
-  * This program is free software; you can redistribute it and/or\r
-  * modify it under the terms of the GNU General Public License\r
-  * as published by the Free Software Foundation; either version 2\r
-  * of the License, or (at your option) any later version.\r
-  * (see nucleus/documentation/index.html#license for more info)\r
-  *\r
-  * A class representing 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
-  */\r
-class COMMENTS {\r
-\r
-       // item for which comment are being displayed\r
-       var $itemid;\r
-\r
-       // reference to the itemActions object that is calling the showComments function\r
-       var $itemActions;\r
-\r
-       // total amount of comments displayed\r
-       var $commentcount;\r
-\r
-       /**\r
-        * Creates a new COMMENTS object for the given blog and item\r
-        *\r
-        * @param $itemid\r
-        *              id of the item\r
-        */\r
-       function COMMENTS($itemid) {\r
-               $this->itemid = intval($itemid);\r
-       }\r
-       /**\r
-        * Used when parsing comments\r
-        *\r
-        * @param $itemActions\r
-        *              itemActions object, that will take care of the parsing\r
-        */\r
-       function setItemActions(&$itemActions) {\r
-               $this->itemActions =& $itemActions;\r
-       }\r
-\r
-       /**\r
-        * Shows maximum $max comments to the given item using the given template\r
-        * returns the amount of shown comments (if maxToShow = -1, then there is no limit)\r
-        *\r
-        * @param template\r
-        *              template to use\r
-        * @param maxToShow\r
-        *              max. comments to show\r
-        * @param showNone\r
-        *              indicates if the 'no comments' thingie should be outputted when there are no comments\r
-        *              (useful for closed items)\r
-        * @param highlight\r
-        *              Highlight to use (if any)\r
-        */\r
-       function showComments($template, $maxToShow = -1, $showNone = 1, $highlight = '') {\r
-               global $CONF, $manager;\r
-\r
-               // create parser object & action handler\r
-               $actions =& new COMMENTACTIONS($this);\r
-               $parser =& new PARSER($actions->getDefinedActions(),$actions);\r
-               $actions->setTemplate($template);\r
-               $actions->setParser($parser);\r
-\r
-               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
-                                  . ' FROM '.sql_table('comment').' as c'\r
-                                  . ' WHERE c.citem=' . $this->itemid\r
-                                  . ' ORDER BY c.ctime';\r
-\r
-                       $comments = sql_query($query);\r
-                       $this->commentcount = mysql_num_rows($comments);\r
-               }\r
-\r
-               // if no result was found\r
-               if ($this->commentcount == 0) {\r
-                       // note: when no reactions, COMMENTS_HEADER and COMMENTS_FOOTER are _NOT_ used\r
-                       if ($showNone) $parser->parse($template['COMMENTS_NONE']);\r
-                       return 0;\r
-               }\r
-\r
-               // if too many comments to show\r
-               if (($maxToShow != -1) && ($this->commentcount > $maxToShow)) {\r
-                       $parser->parse($template['COMMENTS_TOOMUCH']);\r
-                       return 0;\r
-               }\r
-\r
-               $parser->parse($template['COMMENTS_HEADER']);\r
-\r
-               while ( $comment = mysql_fetch_assoc($comments) ) {\r
-                       $comment['timestamp'] = strtotime($comment['ctime']);\r
-                       $actions->setCurrentComment($comment);\r
-                       $actions->setHighlight($highlight);\r
-                       $manager->notify('PreComment', array('comment' => &$comment));\r
-                       $parser->parse($template['COMMENTS_BODY']);\r
-                       $manager->notify('PostComment', array('comment' => &$comment));\r
-               }\r
-\r
-               $parser->parse($template['COMMENTS_FOOTER']);\r
-\r
-               mysql_free_result($comments);\r
-\r
-               return $this->commentcount;\r
-       }\r
-\r
-       /**\r
-        * Returns the amount of comments for this itemid\r
-        */\r
-       function amountComments() {\r
-               $query =  'SELECT COUNT(*)'\r
-                          . ' FROM '.sql_table('comment').' as c'\r
-                          . ' WHERE c.citem='. $this->itemid;\r
-               $res = sql_query($query);\r
-               $arr = mysql_fetch_row($res);\r
-\r
-               return $arr[0];\r
-       }\r
-\r
-\r
-       function addComment($timestamp, $comment) {\r
-               global $CONF, $member, $manager;\r
-\r
-               $blogid = getBlogIDFromItemID($this->itemid);\r
-\r
-               $settings =& $manager->getBlog($blogid);\r
-               $settings->readSettings();\r
-\r
-               if (!$settings->commentsEnabled())\r
-                       return _ERROR_COMMENTS_DISABLED;\r
-\r
-               if (!$settings->isPublic() && !$member->isLoggedIn())\r
-                       return _ERROR_COMMENTS_NONPUBLIC;\r
-\r
-               // member name protection\r
-               if ($CONF['ProtectMemNames'] && !$member->isLoggedIn() && MEMBER::isNameProtected($comment['user']))\r
-                       return _ERROR_COMMENTS_MEMBERNICK;\r
-\r
-               // isValidComment returns either "1" or an error message\r
-               $isvalid = $this->isValidComment($comment);\r
-               if ($isvalid != 1)\r
-                       return $isvalid;\r
-\r
-               $comment['timestamp'] = $timestamp;\r
-               $comment['host'] = gethostbyaddr(serverVar('REMOTE_ADDR'));\r
-               $comment['ip'] = serverVar('REMOTE_ADDR');\r
-\r
-               // if member is logged in, use that data\r
-               if ($member->isLoggedIn()) {\r
-                       $comment['memberid'] = $member->getID();\r
-                       $comment['user'] = '';\r
-                       $comment['userid'] = '';\r
-               } else {\r
-                       $comment['memberid'] = 0;\r
-               }\r
-\r
-\r
-               // send email to notification address, if any\r
-               if ($settings->getNotifyAddress() && $settings->notifyOnComment()) {\r
-\r
-                       $mailto_msg = _NOTIFY_NC_MSG . ' ' . $this->itemid . "\n";\r
-                       $mailto_msg .= $CONF['IndexURL'] . 'index.php?itemid=' . $this->itemid . "\n\n";\r
-                       if ($comment['memberid'] == 0) {\r
-                               $mailto_msg .= _NOTIFY_USER . ' ' . $comment['user'] . "\n";\r
-                               $mailto_msg .= _NOTIFY_USERID . ' ' . $comment['userid'] . "\n";\r
-                       } else {\r
-                               $mailto_msg .= _NOTIFY_MEMBER .' ' . $member->getDisplayName() . ' (ID=' . $member->getID() . ")\n";\r
-                       }\r
-                       $mailto_msg .= _NOTIFY_HOST . ' ' . $comment['host'] . "\n";\r
-                       $mailto_msg .= _NOTIFY_COMMENT . "\n " . $comment['body'] . "\n";\r
-                       $mailto_msg .= getMailFooter();\r
-\r
-                       $item =& $manager->getItem($this->itemid, 0, 0);\r
-                       $mailto_title = _NOTIFY_NC_TITLE . ' ' . strip_tags($item['title']) . ' (' . $this->itemid . ')';\r
-\r
-                       $frommail = $member->getNotifyFromMailAddress($comment['userid']);\r
-\r
-                       $notify =& new NOTIFICATION($settings->getNotifyAddress());\r
-                       $notify->notify($mailto_title, $mailto_msg , $frommail);\r
-               }\r
-\r
-               $comment = COMMENT::prepare($comment);\r
-\r
-               $manager->notify('PreAddComment',array('comment' => &$comment));\r
-\r
-               $name           = addslashes($comment['user']);\r
-               $url            = addslashes($comment['userid']);\r
-               $body           = addslashes($comment['body']);\r
-               $host           = addslashes($comment['host']);\r
-               $ip                     = addslashes($comment['ip']);\r
-               $memberid       = intval($comment['memberid']);\r
-               $timestamp      = date('Y-m-d H:i:s', $comment['timestamp']);\r
-               $itemid         = $this->itemid;\r
-\r
-               $query = 'INSERT INTO '.sql_table('comment').' (CUSER, CMAIL, CMEMBER, CBODY, CITEM, CTIME, CHOST, CIP, CBLOG) '\r
-                          . "VALUES ('$name', '$url', $memberid, '$body', $itemid, '$timestamp', '$host', '$ip', '$blogid')";\r
-\r
-               sql_query($query);\r
-\r
-               // post add comment\r
-               $commentid = mysql_insert_id();\r
-               $manager->notify('PostAddComment',array('comment' => &$comment, 'commentid' => &$commentid));\r
-\r
-               // succeeded !\r
-               return true;\r
-       }\r
-\r
-\r
-       function isValidComment($comment) {\r
-               global $member, $manager;\r
-\r
-               // check if there exists a item for this date\r
-               $item =& $manager->getItem($this->itemid,0,0);\r
-\r
-               if (!$item)\r
-                       return _ERROR_NOSUCHITEM;\r
-\r
-               if ($item['closed'])\r
-                       return _ERROR_ITEMCLOSED;\r
-\r
-               // don't allow words that are too long\r
-               if (eregi('[a-zA-Z0-9|\.,;:!\?=\/\\]{90,90}',$comment['body']) != false)\r
-                       return _ERROR_COMMENT_LONGWORD;\r
-\r
-               // check lengths of comment\r
-               if (strlen($comment['body'])<3)\r
-                       return _ERROR_COMMENT_NOCOMMENT;\r
-\r
-               if (strlen($comment['body'])>5000)\r
-                       return _ERROR_COMMENT_TOOLONG;\r
-\r
-               // only check username if no member logged in\r
-               if (!$member->isLoggedIn())\r
-                       if (strlen($comment['user'])<2)\r
-                               return _ERROR_COMMENT_NOUSERNAME;\r
-\r
-               // let plugins do verification (any plugin which thinks the comment is invalid\r
-               // can change 'error' to something other than '1')\r
-               $result = 1;\r
-               $manager->notify('ValidateForm', array('type' => 'comment', 'comment' => &$comment, 'error' => &$result));\r
-\r
-               return $result;\r
-       }\r
-\r
-\r
-}\r
-\r
-/**\r
-  * This class is used when parsing comment templates\r
-  */\r
-class COMMENTACTIONS extends BaseActions {\r
-\r
-       // ref to COMMENTS object which is using this object to handle\r
-       // its templatevars\r
-       var $commentsObj;\r
-\r
-       // template to use to parse the comments\r
-       var $template;\r
-\r
-       // comment currenlty being handled (mysql result assoc array; see COMMENTS::showComments())\r
-       var $currentComment;\r
-\r
-       function COMMENTACTIONS(&$comments) {\r
-               // call constructor of superclass first\r
-               $this->BaseActions();\r
-\r
-               // reference to the comments object\r
-               $this->setCommentsObj($comments);\r
-       }\r
-\r
-       function getDefinedActions() {\r
-               return array(\r
-                       'commentcount',\r
-                       'commentword',\r
-                       'itemlink',\r
-                       'itemid',\r
-                       'itemtitle',\r
-                       'date',\r
-                       'time',\r
-                       'commentid',\r
-                       'body',\r
-                       'memberid',\r
-                       'timestamp',\r
-                       'host',\r
-                       'ip',\r
-                       'blogid',\r
-                       'authtext',\r
-                       'user',\r
-                       'userid',\r
-                       'userlinkraw',\r
-                       'userlink',\r
-                       'short',\r
-                       'skinfile',\r
-                       'set',\r
-                       'plugin',\r
-                       'include',\r
-                       'phpinclude',\r
-                       'parsedinclude'\r
-               );\r
-       }\r
-\r
-       function setParser(&$parser) {                  $this->parser =& $parser; }\r
-       function setCommentsObj(&$commentsObj) {$this->commentsObj =& $commentsObj; }\r
-       function setTemplate($template) {               $this->template =& $template; }\r
-       function setCurrentComment(&$comment) {\r
-               if ($comment['memberid'] != 0) {\r
-                       $comment['authtext'] = $template['COMMENTS_AUTH'];\r
-\r
-                       $mem = MEMBER::createFromID($comment['memberid']);\r
-                       $comment['user'] = $mem->getDisplayName();\r
-                       if ($mem->getURL())\r
-                               $comment['userid'] = $mem->getURL();\r
-                       else\r
-                               $comment['userid'] = $mem->getEmail();\r
-\r
-                       $comment['userlinkraw'] = createMemberLink(\r
-                                                                               $comment['memberid'],\r
-                                                                               $this->commentsObj->itemActions->linkparams\r
-                                                                         );\r
-\r
-               } else {\r
-\r
-                       // create smart links\r
-                       if (isValidMailAddress($comment['userid']))\r
-                               $comment['userlinkraw'] = 'mailto:'.$comment['userid'];\r
-                       elseif (strstr($comment['userid'],'http://') != false)\r
-                               $comment['userlinkraw'] = $comment['userid'];\r
-                       elseif (strstr($comment['userid'],'www') != false)\r
-                               $comment['userlinkraw'] = 'http://'.$comment['userid'];\r
-               }\r
-\r
-               $this->currentComment =& $comment;\r
-       }\r
-\r
-       function parse_commentcount() {                 echo $this->commentsObj->commentcount; }\r
-       function parse_commentword() {\r
-               if ($this->commentsObj->commentcount == 1)\r
-                       echo $this->template['COMMENTS_ONE'];\r
-               else\r
-                       echo $this->template['COMMENTS_MANY'];\r
-       }\r
-\r
-       function parse_itemlink() {                             echo createItemLink($this->commentsObj->itemid, $this->commentsObj->itemActions->linkparams); }\r
-       function parse_itemid() {                               echo $this->commentsObj->itemid; }\r
-       function parse_itemtitle($maxLength = 0) {\r
-               if ($maxLength == 0)\r
-                       $this->commentsObj->itemActions->parse_title();\r
-               else\r
-                       $this->commentsObj->itemActions->parse_syndicate_title($maxLength);\r
-       }\r
-\r
-       function parse_date($format = '') {\r
-               echo formatDate($format, $this->currentComment['timestamp'], $this->template['FORMAT_DATE']);\r
-       }\r
-       function parse_time($format = '') {\r
-               echo strftime(\r
-                               ($format == '') ? $this->template['FORMAT_TIME'] : $format,\r
-                               $this->currentComment['timestamp']\r
-                       );\r
-       }\r
-\r
-       function parse_commentid() {                    echo $this->currentComment['commentid']; }\r
-       function parse_body() {                                 echo $this->highlight($this->currentComment['body']); }\r
-       function parse_memberid() {                             echo $this->currentComment['memberid']; }\r
-       function parse_timestamp() {                    echo $this->currentComment['timestamp']; }\r
-       function parse_host() {                                 echo $this->currentComment['host']; }\r
-       function parse_ip() {                                   echo $this->currentComment['ip']; }\r
-       function parse_blogid() {                               echo $this->currentComment['blogid']; }\r
-\r
-       function parse_user() {                                 echo $this->currentComment['user']; }\r
-       function parse_userid() {                               echo $this->currentComment['userid']; }\r
-       function parse_userlinkraw() {                  echo $this->currentComment['userlinkraw']; }\r
-       function parse_userlink() {\r
-               if ($this->currentComment['userlinkraw']) {\r
-                       echo '<a href="'.$this->currentComment['userlinkraw'].'" rel="nofollow">'.$this->currentComment['user'].'</a>';\r
-               } else {\r
-                       echo $this->currentComment['user'];\r
-               }\r
-       }\r
-       function parse_short() {\r
-               $tmp = strtok($this->currentComment['body'],"\n");\r
-               $tmp = str_replace('<br />','',$tmp);\r
-               echo $tmp;\r
-               if ($tmp != $this->currentComment['body'])\r
-                       $this->parser->parse($this->template['COMMENTS_CONTINUED']);\r
-       }\r
-       function parse_authtext() {\r
-               if ($this->currentComment['memberid'] != 0)\r
-                       $this->parser->parse($this->template['COMMENTS_AUTH']);\r
-       }\r
-\r
-       /**\r
-         * Executes a plugin templatevar\r
-         *\r
-         * @param pluginName name of plugin (without the NP_)\r
-         *\r
-         * extra parameters can be added\r
-         */\r
-       function parse_plugin($pluginName) {\r
-               global $manager;\r
-\r
-               // only continue when the plugin is really installed\r
-               if (!$manager->pluginInstalled('NP_' . $pluginName))\r
-                       return;\r
-\r
-               $plugin =& $manager->getPlugin('NP_' . $pluginName);\r
-               if (!$plugin) return;\r
-\r
-               // get arguments\r
-               $params = func_get_args();\r
-\r
-               // remove plugin name\r
-               array_shift($params);\r
-\r
-               // pass info on current item and current comment as well\r
-               $params = array_merge(array(&$this->currentComment),$params);\r
-               $params = array_merge(array(&$this->commentsObj->itemActions->currentItem),$params);\r
-\r
-               call_user_func_array(array(&$plugin,'doTemplateCommentsVar'), $params);\r
-       }\r
-}\r
-\r
-?>\r
+<?php
+
+/*
+ * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
+ * Copyright (C) 2002-2006 The Nucleus Group
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * (see nucleus/documentation/index.html#license for more info)
+ */
+/**
+ * A class representing the comments (all of them) for a certain post on a ceratin blog
+ *
+ * @license http://nucleuscms.org/license.txt GNU General Public License
+ * @copyright Copyright (C) 2002-2006 The Nucleus Group
+ * @version $Id: COMMENTS.php,v 1.6 2006-07-17 20:03:44 kimitake Exp $
+ * $NucleusJP: COMMENTS.php,v 1.5 2005/03/12 06:19:05 kimitake Exp $
+ */
+
+// temporary: dirt way to separe class COMMENTACTIONS from COMMENTS
+require_once $DIR_LIBS . 'COMMENTACTIONS.php';
+
+class COMMENTS {
+
+       // item for which comment are being displayed
+       var $itemid;
+
+       // reference to the itemActions object that is calling the showComments function
+       var $itemActions;
+
+       // total amount of comments displayed
+       var $commentcount;
+
+       /**
+        * Creates a new COMMENTS object for the given blog and item
+        *
+        * @param $itemid
+        *              id of the item
+        */
+       function COMMENTS($itemid) {
+               $this->itemid = intval($itemid);
+       }
+       /**
+        * Used when parsing comments
+        *
+        * @param $itemActions
+        *              itemActions object, that will take care of the parsing
+        */
+       function setItemActions(&$itemActions) {
+               $this->itemActions =& $itemActions;
+       }
+
+       /**
+        * Shows maximum $max comments to the given item using the given template
+        * returns the amount of shown comments (if maxToShow = -1, then there is no limit)
+        *
+        * @param template
+        *              template to use
+        * @param maxToShow
+        *              max. comments to show
+        * @param showNone
+        *              indicates if the 'no comments' thingie should be outputted when there are no comments
+        *              (useful for closed items)
+        * @param highlight
+        *              Highlight to use (if any)
+        */
+       function showComments($template, $maxToShow = -1, $showNone = 1, $highlight = '') {
+               global $CONF, $manager;
+
+               // create parser object & action handler
+               $actions =& new COMMENTACTIONS($this);
+               $parser =& new PARSER($actions->getDefinedActions(),$actions);
+               $actions->setTemplate($template);
+               $actions->setParser($parser);
+
+               if ($maxToShow == 0) {
+                       $this->commentcount = $this->amountComments();
+               } else {
+                       $query =  'SELECT c.citem as itemid, c.cnumber as commentid, c.cbody as body, c.cuser as user, c.cmail as userid, c.cemail as email, c.cmember as memberid, c.ctime, c.chost as host, c.cip as ip, c.cblog as blogid'
+                                  . ' FROM '.sql_table('comment').' as c'
+                                  . ' WHERE c.citem=' . $this->itemid
+                                  . ' ORDER BY c.ctime';
+
+                       $comments = sql_query($query);
+                       $this->commentcount = mysql_num_rows($comments);
+               }
+
+               // if no result was found
+               if ($this->commentcount == 0) {
+                       // note: when no reactions, COMMENTS_HEADER and COMMENTS_FOOTER are _NOT_ used
+                       if ($showNone) $parser->parse($template['COMMENTS_NONE']);
+                       return 0;
+               }
+
+               // if too many comments to show
+               if (($maxToShow != -1) && ($this->commentcount > $maxToShow)) {
+                       $parser->parse($template['COMMENTS_TOOMUCH']);
+                       return 0;
+               }
+
+               $parser->parse($template['COMMENTS_HEADER']);
+
+               while ( $comment = mysql_fetch_assoc($comments) ) {
+                       $comment['timestamp'] = strtotime($comment['ctime']);
+                       $actions->setCurrentComment($comment);
+                       $actions->setHighlight($highlight);
+                       $manager->notify('PreComment', array('comment' => &$comment));
+                       $parser->parse($template['COMMENTS_BODY']);
+                       $manager->notify('PostComment', array('comment' => &$comment));
+               }
+
+               $parser->parse($template['COMMENTS_FOOTER']);
+
+               mysql_free_result($comments);
+
+               return $this->commentcount;
+       }
+
+       /**
+        * Returns the amount of comments for this itemid
+        */
+       function amountComments() {
+               $query =  'SELECT COUNT(*)'
+                          . ' FROM '.sql_table('comment').' as c'
+                          . ' WHERE c.citem='. $this->itemid;
+               $res = sql_query($query);
+               $arr = mysql_fetch_row($res);
+
+               return $arr[0];
+       }
+
+
+       function addComment($timestamp, $comment) {
+               global $CONF, $member, $manager;
+
+               $blogid = getBlogIDFromItemID($this->itemid);
+
+               $settings =& $manager->getBlog($blogid);
+               $settings->readSettings();
+
+               if (!$settings->commentsEnabled())
+                       return _ERROR_COMMENTS_DISABLED;
+
+               if (!$settings->isPublic() && !$member->isLoggedIn())
+                       return _ERROR_COMMENTS_NONPUBLIC;
+
+               // member name protection
+               if ($CONF['ProtectMemNames'] && !$member->isLoggedIn() && MEMBER::isNameProtected($comment['user']))
+                       return _ERROR_COMMENTS_MEMBERNICK;
+
+               // email required protection
+               if ($settings->emailRequired() && strlen($comment['email']) == 0 && !$member->isLoggedIn()) {
+                       return _ERROR_EMAIL_REQUIRED;
+               }
+
+               $comment['timestamp'] = $timestamp;
+               $comment['host'] = gethostbyaddr(serverVar('REMOTE_ADDR'));
+               $comment['ip'] = serverVar('REMOTE_ADDR');
+
+               // if member is logged in, use that data
+               if ($member->isLoggedIn()) {
+                       $comment['memberid'] = $member->getID();
+                       $comment['user'] = '';
+                       $comment['userid'] = '';
+                       $comment['email'] = '';
+               } else {
+                       $comment['memberid'] = 0;
+               }
+
+               // spam check
+               $continue = false;
+               $plugins = array();
+
+               if (isset($manager->subscriptions['ValidateForm']))
+                       $plugins = array_merge($plugins, $manager->subscriptions['ValidateForm']);
+
+               if (isset($manager->subscriptions['PreAddComment']))
+                       $plugins = array_merge($plugins, $manager->subscriptions['PreAddComment']);
+
+               if (isset($manager->subscriptions['PostAddComment']))
+                       $plugins = array_merge($plugins, $manager->subscriptions['PostAddComment']);
+
+               $plugins = array_unique($plugins);
+
+               while (list(,$plugin) = each($plugins)) {
+                       $p = $manager->getPlugin($plugin);
+                       $continue = $continue || $p->supportsFeature('handleSpam');
+               }
+
+               $spamcheck = array (
+                       'type'          => 'comment',
+                       'body'          => $comment['body'],
+                       'id'        => $comment['itemid'],
+                       'live'          => true,
+                       'return'        => $continue
+               );
+
+               if ($member->isLoggedIn()) {
+                       $spamcheck['author'] = $member->displayname;
+                       $spamcheck['email'] = $member->email;
+               } else {
+                       $spamcheck['author'] = $comment['user'];
+                       $spamcheck['email'] = $comment['email'];
+                       $spamcheck['url'] = $comment['userid'];
+               }
+
+               $manager->notify('SpamCheck', array ('spamcheck' => &$spamcheck));
+
+               if (!$continue && isset($spamcheck['result']) && $spamcheck['result'] == true)
+                       return _ERROR_COMMENTS_SPAM;
+
+
+               // isValidComment returns either "1" or an error message
+               $isvalid = $this->isValidComment($comment, $spamcheck);
+               if ($isvalid != 1)
+                       return $isvalid;
+
+               // send email to notification address, if any
+               if ($settings->getNotifyAddress() && $settings->notifyOnComment()) {
+
+                       $mailto_msg = _NOTIFY_NC_MSG . ' ' . $this->itemid . "\n";
+                       $mailto_msg .= $CONF['IndexURL'] . 'index.php?itemid=' . $this->itemid . "\n\n";
+                       if ($comment['memberid'] == 0) {
+                               $mailto_msg .= _NOTIFY_USER . ' ' . $comment['user'] . "\n";
+                               $mailto_msg .= _NOTIFY_USERID . ' ' . $comment['userid'] . "\n";
+                       } else {
+                               $mailto_msg .= _NOTIFY_MEMBER .' ' . $member->getDisplayName() . ' (ID=' . $member->getID() . ")\n";
+                       }
+                       $mailto_msg .= _NOTIFY_HOST . ' ' . $comment['host'] . "\n";
+                       $mailto_msg .= _NOTIFY_COMMENT . "\n " . $comment['body'] . "\n";
+                       $mailto_msg .= getMailFooter();
+
+                       $item =& $manager->getItem($this->itemid, 0, 0);
+                       $mailto_title = _NOTIFY_NC_TITLE . ' ' . strip_tags($item['title']) . ' (' . $this->itemid . ')';
+
+                       $frommail = $member->getNotifyFromMailAddress($comment['userid']);
+
+                       $notify =& new NOTIFICATION($settings->getNotifyAddress());
+                       $notify->notify($mailto_title, $mailto_msg , $frommail);
+               }
+
+               $comment = COMMENT::prepare($comment);
+
+               $manager->notify('PreAddComment',array('comment' => &$comment, 'spamcheck' => &$spamcheck));
+
+               $name           = addslashes($comment['user']);
+               $url            = addslashes($comment['userid']);
+               $email      = addslashes($comment['email']);
+               $body           = addslashes($comment['body']);
+               $host           = addslashes($comment['host']);
+               $ip                     = addslashes($comment['ip']);
+               $memberid       = intval($comment['memberid']);
+               $timestamp      = date('Y-m-d H:i:s', $comment['timestamp']);
+               $itemid         = $this->itemid;
+
+               $query = 'INSERT INTO '.sql_table('comment').' (CUSER, CMAIL, CEMAIL, CMEMBER, CBODY, CITEM, CTIME, CHOST, CIP, CBLOG) '
+                          . "VALUES ('$name', '$url', '$email', $memberid, '$body', $itemid, '$timestamp', '$host', '$ip', '$blogid')";
+
+               sql_query($query);
+
+               // post add comment
+               $commentid = mysql_insert_id();
+               $manager->notify('PostAddComment',array('comment' => &$comment, 'commentid' => &$commentid, 'spamcheck' => &$spamcheck));
+
+               // succeeded !
+               return true;
+       }
+
+
+       function isValidComment($comment, & $spamcheck) {
+               global $member, $manager;
+
+               // check if there exists a item for this date
+               $item =& $manager->getItem($this->itemid,0,0);
+
+               if (!$item)
+                       return _ERROR_NOSUCHITEM;
+
+               if ($item['closed'])
+                       return _ERROR_ITEMCLOSED;
+
+               // don't allow words that are too long
+               if (eregi('[a-zA-Z0-9|\.,;:!\?=\/\\]{90,90}',$comment['body']) != false)
+                       return _ERROR_COMMENT_LONGWORD;
+
+               // check lengths of comment
+               if (strlen($comment['body'])<3)
+                       return _ERROR_COMMENT_NOCOMMENT;
+
+               if (strlen($comment['body'])>5000)
+                       return _ERROR_COMMENT_TOOLONG;
+
+               // only check username if no member logged in
+               if (!$member->isLoggedIn())
+                       if (strlen($comment['user'])<2)
+                               return _ERROR_COMMENT_NOUSERNAME;
+
+               if ((strlen($comment['email']) != 0) && !(isValidMailAddress($comment['email']))) {
+                       return _ERROR_BADMAILADDRESS;
+               }
+
+               // let plugins do verification (any plugin which thinks the comment is invalid
+               // can change 'error' to something other than '1')
+               $result = 1;
+               $manager->notify('ValidateForm', array('type' => 'comment', 'comment' => &$comment, 'error' => &$result, 'spamcheck' => &$spamcheck));
+
+               return $result;
+       }
+
+}
+
+?>
index b12de3b..bfef871 100755 (executable)
-<?php\r
-\r
-/*\r
- * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
- * Copyright (C) 2002-2005 The Nucleus Group\r
- *\r
- * This program is free software; you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License\r
- * as published by the Free Software Foundation; either version 2\r
- * of the License, or (at your option) any later version.\r
- * (see nucleus/documentation/index.html#license for more info)\r
- */\r
-/**\r
- * A class representing an item\r
- *\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.4 2005-08-13 07:33:02 kimitake Exp $\r
-  * $NucleusJP: ITEM.php,v 1.3 2005/03/12 06:19:05 kimitake Exp $\r
- */\r
-class ITEM {\r
-       \r
-       var $itemid;\r
-       \r
-       function ITEM($itemid) {\r
-               $this->itemid = $itemid;\r
-       }\r
-       \r
-       /**\r
-         * Returns one item with the specific itemid\r
-         * (static)\r
-         */\r
-       function getitem($itemid, $allowdraft, $allowfuture) {\r
-               global $manager;\r
-\r
-               $itemid = intval($itemid);\r
-               \r
-               $query =  'SELECT i.idraft as draft, i.inumber as itemid, i.iclosed as closed, '\r
-                      . ' i.ititle as title, i.ibody as body, m.mname as author, '\r
-                      . ' i.iauthor as authorid, i.itime, i.imore as more, i.ikarmapos as karmapos, '\r
-                      . ' i.ikarmaneg as karmaneg, i.icat as catid, i.iblog as blogid '\r
-                      . ' FROM '.sql_table('item').' as i, '.sql_table('member').' as m, ' . sql_table('blog') . ' as b '\r
-                      . ' WHERE i.inumber=' . $itemid\r
-                      . ' and i.iauthor=m.mnumber '\r
-                      . ' and i.iblog=b.bnumber';\r
-                      \r
-               if (!$allowdraft)\r
-                       $query .= ' and i.idraft=0';\r
-                       \r
-               if (!$allowfuture) {\r
-                       $blog =& $manager->getBlog(getBlogIDFromItemID($itemid));\r
-                       $query .= ' and i.itime <=' . mysqldate($blog->getCorrectTime());               \r
-               }\r
-               \r
-               $query .= ' LIMIT 1';\r
-\r
-               $res = sql_query($query);\r
-\r
-               if (mysql_num_rows($res) == 1)\r
-               {\r
-                       $aItemInfo = mysql_fetch_assoc($res);\r
-                       $aItemInfo['timestamp'] = strtotime($aItemInfo['itime']);       \r
-                       return $aItemInfo;\r
-               } else {\r
-                       return 0;\r
-               }\r
-\r
-       }       \r
-       \r
-       /**\r
-        * Tries to create an item from the data in the current request (comes from\r
-        * bookmarklet or admin area \r
-        *\r
-        * Returns an array with status info (status = 'added', 'error', 'newcategory')\r
-        *\r
-        * (static)\r
-        */\r
-       function createFromRequest() {\r
-                global $member, $manager;\r
-                \r
-                $i_author =            $member->getID();\r
-                $i_body =                      postVar('body');\r
-                $i_title =                     postVar('title');\r
-                $i_more =                      postVar('more');\r
-                $i_actiontype =        postVar('actiontype');           \r
-                $i_closed =            intPostVar('closed');\r
-                $i_hour =                      intPostVar('hour');              \r
-                $i_minutes =           intPostVar('minutes');           \r
-                $i_month =             intPostVar('month');             \r
-                $i_day =                       intPostVar('day');               \r
-                $i_year =                      intPostVar('year');                              \r
-\r
-                $i_catid =             postVar('catid');\r
-                \r
-                if (!$member->canAddItem($i_catid))\r
-                       return array('status' => 'error', 'message' => _ERROR_DISALLOWED);\r
-                \r
-                if (!$i_actiontype) $i_actiontype = 'addnow';\r
-\r
-                switch ($i_actiontype) {\r
-                       case 'adddraft':\r
-                               $i_draft = 1;\r
-                               break;\r
-                       case 'addfuture':\r
-                       case 'addnow':\r
-                       default:\r
-                               $i_draft = 0;\r
-                }\r
-                \r
-                if (!trim($i_body))\r
-                       return array('status' => 'error', 'message' => _ERROR_NOEMPTYITEMS);\r
-                \r
-               // create new category if needed \r
-               if (strstr($i_catid,'newcat')) {\r
-                       // get blogid \r
-                       list($i_blogid) = sscanf($i_catid,"newcat-%d");\r
-                       \r
-                       // create\r
-                       $blog =& $manager->getBlog($i_blogid);\r
-                       $i_catid = $blog->createNewCategory();\r
-\r
-                       // show error when sth goes wrong\r
-                       if (!$i_catid) \r
-                               return array('status' => 'error','message' => 'Could not create new category');\r
-               } else {\r
-                       // force blogid (must be same as category id)\r
-                       $i_blogid = getBlogIDFromCatID($i_catid);\r
-                       $blog =& $manager->getBlog($i_blogid);\r
-               }\r
-               \r
-               if ($i_actiontype == 'addfuture') {\r
-                       $posttime = mktime($i_hour, $i_minutes, 0, $i_month, $i_day, $i_year);\r
-                       \r
-                       // make sure the date is in the future, unless we allow past dates \r
-                       if ((!$blog->allowPastPosting()) && ($posttime < $blog->getCorrectTime()))\r
-                               $posttime = $blog->getCorrectTime();\r
-               } else {\r
-                       // time with offset, or 0 for drafts\r
-                       $posttime = $i_draft ? 0 : $blog->getCorrectTime();     \r
-               }\r
-               \r
-               $itemid = $blog->additem($i_catid, $i_title,$i_body,$i_more,$i_blogid,$i_author,$posttime,$i_closed,$i_draft);  \r
-               \r
-               //Setting the itemOptions\r
-               $aOptions = requestArray('plugoption');\r
-               NucleusPlugin::_applyPluginOptions($aOptions, $itemid);\r
-               $manager->notify('PostPluginOptionsUpdate',array('context' => 'item', 'itemid' => $itemid, 'item' => array('title' => $i_title, 'body' => $i_body, 'more' => $i_more, 'closed' => $i_closed, 'catid' => $i_catid)));\r
-               \r
-               // success\r
-               if ($i_catid != intRequestVar('catid'))\r
-                       return array('status' => 'newcategory', 'itemid' => $itemid, 'catid' => $i_catid);\r
-               else\r
-                       return array('status' => 'added', 'itemid' => $itemid);\r
-       }\r
-       \r
-       \r
-       /**\r
-         * Updates an item (static)\r
-         */\r
-       function update($itemid, $catid, $title, $body, $more, $closed, $wasdraft, $publish, $timestamp = 0) {\r
-               global $manager;\r
-               \r
-               $itemid = intval($itemid);\r
-\r
-               // make sure value is 1 or 0\r
-               if ($closed != 1) $closed = 0;\r
-                       \r
-               // get destination blogid \r
-               $new_blogid = getBlogIDFromCatID($catid);\r
-               $old_blogid = getBlogIDFromItemID($itemid);\r
-               \r
-               // move will be done on end of method\r
-               if ($new_blogid != $old_blogid)\r
-                       $moveNeeded = 1;\r
-               \r
-               // add <br /> before newlines\r
-               $blog =& $manager->getBlog($new_blogid);\r
-               if ($blog->convertBreaks()) {\r
-                       $body = addBreaks($body);\r
-                       $more = addBreaks($more);\r
-               }\r
-       \r
-               // call plugins\r
-               $manager->notify('PreUpdateItem',array('itemid' => $itemid, 'title' => &$title, 'body' => &$body, 'more' => &$more, 'blog' => &$blog, 'closed' => &$closed, 'catid' => &$catid));\r
-       \r
-               // update item itsself\r
-               $query =  'UPDATE '.sql_table('item')\r
-                      . ' SET' \r
-                      . " ibody='". addslashes($body) ."',"\r
-                      . " ititle='" . addslashes($title) . "',"\r
-                      . " imore='" . addslashes($more) . "',"\r
-                      . " iclosed=" . intval($closed) . ","\r
-                      . " icat=" . intval($catid);\r
-\r