<?php
// $Id: forumform.inc.php,v 1.5 2005/09/04 20:46:10 onokazu Exp $
//  ------------------------------------------------------------------------ //
//                XOOPS - PHP Content Management System                      //
//                    Copyright (c) 2000 XOOPS.org                           //
//                       <http://www.xoops.org/>                             //
//  ------------------------------------------------------------------------ //
//  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.                                      //
//                                                                           //
//  You may not change or alter any portion of this comment or credits       //
//  of supporting developers from this source code or any supporting         //
//  source code which is considered copyrighted (c) material of the          //
//  original comment or credit authors.                                      //
//                                                                           //
//  This program is distributed in the hope that it will be useful,          //
//  but WITHOUT ANY WARRANTY; without even the implied warranty of           //
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            //
//  GNU General Public License for more details.                             //
//                                                                           //
//  You should have received a copy of the GNU General Public License        //
//  along with this program; if not, write to the Free Software              //
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
//  ------------------------------------------------------------------------ //
// Author: Kazumi Ono (AKA onokazu)                                          //
// URL: http://www.myweb.ne.jp/, http://www.xoops.org/, http://jp.xoops.org/ //
// Project: The XOOPS Project                                                //
// ------------------------------------------------------------------------- //

if (!defined('XOOPS_ROOT_PATH')) {
    exit();
}
include_once XOOPS_ROOT_PATH."/class/xoopslists.php";
include_once XOOPS_ROOT_PATH."/include/xoopscodes.php";

$token=&XoopsMultiTokenHandler::quickCreate('newbb_post');

echo "<form action='post.php' method='post' name='forumform' id='forumform' onsubmit='return xoopsValidate(\"subject\", \"message\", \"contents_submit\", \"".htmlspecialchars(_PLZCOMPLETE, ENT_QUOTES)."\", \"".htmlspecialchars(_MESSAGETOOLONG, ENT_QUOTES)."\", \"".htmlspecialchars(_ALLOWEDCHAR, ENT_QUOTES)."\", \"".htmlspecialchars(_CURRCHAR, ENT_QUOTES)."\");'><table cellspacing='1' class='outer' width='100%'><tr><td class='head' width='25%' valign='top'>". _MD_ABOUTPOST .":</td>";
echo $token->getHtml();

if ( $forumdata['forum_type'] == 1 ) {
    echo "<td class='even'>". _MD_PRIVATE ."</td>";
} elseif ( $forumdata['forum_access'] == 1 ) {
    echo "<td class='even'>". _MD_REGCANPOST ."</td>";
} elseif ( $forumdata['forum_access'] == 2 ) {
    echo "<td class='even'>". _MD_ANONCANPOST ."</td>";
} elseif ( $forumdata['forum_access'] == 3 ) {
    echo "<td class='even'>". _MD_MODSCANPOST ."</td>";
}

echo "</tr>
<tr>
<td class='head' valign='top' nowrap='nowrap'>". _MD_SUBJECTC ."</td>
<td class='odd'>";

echo "<input type='text' id='subject' name='subject' size='60' maxlength='100' value='$subject' /></td></tr>
<tr>
<td class='head' valign='top' nowrap='nowrap'>". _MD_RESPONSE ."</td>
<td class='even'>
";

// 対応状況
echo " <select name='response'>";
echo "<option value=''>選択なし</option>";
foreach ($arrResponse as $key => $val){
	echo "<option value='" . $key . "' >" . $val . "</option>";
}

echo "</select></td></tr>
<tr>
<td class='head' valign='top' nowrap='nowrap'>". _MD_MESSAGEICON ."</td>
<td class='odd'>
";


$lists = new XoopsLists;
$filelist = $lists->getSubjectsList();
$count = 1;
while ( list($key, $file) = each($filelist) ) {
    $checked = "";
    if ( isset($icon) && $file==$icon ) {
        $checked = " checked='checked'";
    }
    echo "<input type='radio' value='$file' name='icon'$checked />&nbsp;";
    echo "<img src='".XOOPS_URL."/images/subject/$file' alt='' />&nbsp;";
    if ( $count == 8 ) {
        echo "<br />";
        $count = 0;
    }
    $count++;
}

echo "</td></tr>
<tr align='left'>
<td class='head' valign='top' nowrap='nowrap'>". _MD_MESSAGEC ."
</td>
<td class='even'>";
xoopsCodeTarea("message");

if ( !empty($isreply) && isset($hidden) && $hidden != "" ) {
    echo "<input type='hidden' name='isreply' value='1' />";
    echo "<input type='hidden' name='hidden' id='hidden' value='$hidden' />
    <input type='button' name='quote' class='formButton' value='"._MD_QUOTE."' onclick='xoopsGetElementById(\"message\").value=xoopsGetElementById(\"message\").value + xoopsGetElementById(\"hidden\").value; xoopsGetElementById(\"hidden\").value=\"\";' /><br />";
}
xoopsSmilies("message");

echo "</td></tr>
<tr>";
echo "<td class='head' valign='top' nowrap='nowrap'>"._MD_OPTIONS."</td>\n";
echo "<td class='odd'>";

if ( $xoopsUser && $forumdata['forum_access'] == 2 && !empty($post_id) ) {
    echo "<input type='checkbox' name='noname' value='1'";
    if ( isset($noname) && $noname ) {
        echo " checked='checked'";
    }
    echo " />&nbsp;"._MD_POSTANONLY."<br />\n";
}

echo "<input type='checkbox' name='nosmiley' value='1'";
if ( isset($nosmiley) && $nosmiley ) {
    echo " checked='checked'";
}
echo " />&nbsp;"._MD_DISABLESMILEY."<br />\n";

if ( $forumdata['allow_html'] ) {
    echo "<input type='checkbox' name='nohtml' value='1'";
    if ( $nohtml ) {
        echo " checked='checked'";
    }
    echo " />&nbsp;"._MD_DISABLEHTML."<br />\n";
} else {
    echo "<input type='hidden' name='nohtml' value='1' />";
}

if ( $forumdata['allow_sig'] && $xoopsUser ) {
    echo "<input type='checkbox' name='attachsig' value='1'";
    if (isset($_POST['contents_preview'])) {
        if ( $attachsig ) {
            echo " checked='checked' />&nbsp;";
        } else {
            echo " />&nbsp;";
        }
    } else {
        if ($xoopsUser->getVar('attachsig') || !empty($attachsig)) {
            echo " checked='checked' />&nbsp;";
        } else {
            echo "/>&nbsp;";
        }
    }

    echo _MD_ATTACHSIG."<br />\n";
}

if (!empty($xoopsUser) && !empty($xoopsModuleConfig['notification_enabled'])) {
    echo "<input type='hidden' name='istopic' value='1' />";
    echo "<input type='checkbox' name='notify' value='1'";
    if (!empty($notify)) {
        // If 'notify' set, use that value (e.g. preview)
        echo ' checked="checked"';
    } else {
        // Otherwise, check previous subscribed status...
        $notification_handler =& xoops_gethandler('notification');
        if (!empty($topic_id) && $notification_handler->isSubscribed('thread', $topic_id, 'new_post', $xoopsModule->getVar('mid'), $xoopsUser->getVar('uid'))) {
            echo ' checked="checked"';
        }
    }
    echo " />&nbsp;"._MD_NEWPOSTNOTIFY."<br />\n";
}
echo "</td></tr>";
echo "<tr><td class='head' valign='top' nowrap='nowrap'>";
echo "投稿時のご注意：";
echo "</td><td class='even' height=\"90\"><div class=\"box\">";
echo "このサイトはＥＣオープンソースソフトウェアである「ＥＣ−ＣＵＢＥ」の開発コミュニティです。あなたが投稿していただいた内容は、不具合報告、意見、アイディア、プログラムコードその他内容の如何を問わず、「ＥＣ−ＣＵＢＥ」の開発に利用され、<a href=\"http://www.fsf.org/licenses/\" target=\"_blank\">ＧＰＬライセンス※</a>の下で頒布される開発成果物に取り込まれることがあります。<br />
プログラムコードやデザイン等の投稿も歓迎いたしておりますが、投稿に際しては、あなたが創作し、第三者が権利を保持していないもののみを投稿してください。第三者が著作権やその他の知的財産権を有しているものを投稿されますと、その方の権利が侵害され、あなたが法的に賠償責任を負うことがあります。<br />
また「ＥＣ−ＣＵＢＥ」はデュアルライセンス方式を採用しており、ＧＰＬライセンスではなく、株式会社ロックオンが独自に設定するクローズドソースライセンスの下で頒布されることがあります。これを可能とするため、あなたの投稿内容が著作権法上の著作物である場合には、投稿と同時に、あなたの著作権財産権を株式会社ロックオンに移転し、著作者人格権を行使しないことにご同意いただくこととなります。<br /><br />

以上の注意事項に同意いただいた場合のみ投稿ボタンを押してください。<br /><br />

※GPLは、英語で書かれたものが法的な拘束力をもつ唯一の正文ですが、非公式な<a href=\"http://www.opensource.jp/gpl/gpl.ja.html\" target=\"_blank\">日本語訳はこちら</a>をご参照ください。
";

$post_id = isset($post_id) ? intval($post_id) : '';
$topic_id = isset($topic_id) ? intval($topic_id) : '';
$order = isset($order) ? intval($order) : '';
$pid = isset($pid) ? intval($pid) : 0;
echo "</div></td></tr>
<tr><td class='head'></td><td class='odd'>
<input type='hidden' name='pid' value='".intval($pid)."' />
<input type='hidden' name='post_id' value='".$post_id."' />
<input type='hidden' name='topic_id' value='".$topic_id."' />
<input type='hidden' name='forum' value='".intval($forum)."' />
<input type='hidden' name='viewmode' value='$viewmode' />
<input type='hidden' name='order' value='".$order."' />
<input type='submit' name='contents_preview' class='formButton' value='"._PREVIEW."' />&nbsp;<input type='submit' name='contents_submit' class='formButton' id='contents_submit' value='"._MD_POST."' />
<input type='button' onclick='location=\"";
if ( isset($topic_id) && $topic_id != "" ) {
    echo "viewtopic.php?topic_id=".intval($topic_id)."&amp;forum=".intval($forum)."\"'";
} else {
    echo "viewforum.php?forum=".intval($forum)."\"'";
}
echo " class='formButton' value='"._MD_CANCELPOST."' />";
echo "</td></tr></table></form>\n";
?>
