source: temp/test-xoops.ec-cube.net/html/include/comment_form.php @ 405

Revision 405, 6.7 KB checked in by root, 20 years ago (diff)
Line 
1<?php
2// $Id: comment_form.php,v 1.5 2005/08/03 12:39:11 onokazu Exp $
3//  ------------------------------------------------------------------------ //
4//                XOOPS - PHP Content Management System                      //
5//                    Copyright (c) 2000 XOOPS.org                           //
6//                       <http://www.xoops.org/>                             //
7//  ------------------------------------------------------------------------ //
8//  This program is free software; you can redistribute it and/or modify     //
9//  it under the terms of the GNU General Public License as published by     //
10//  the Free Software Foundation; either version 2 of the License, or        //
11//  (at your option) any later version.                                      //
12//                                                                           //
13//  You may not change or alter any portion of this comment or credits       //
14//  of supporting developers from this source code or any supporting         //
15//  source code which is considered copyrighted (c) material of the          //
16//  original comment or credit authors.                                      //
17//                                                                           //
18//  This program is distributed in the hope that it will be useful,          //
19//  but WITHOUT ANY WARRANTY; without even the implied warranty of           //
20//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            //
21//  GNU General Public License for more details.                             //
22//                                                                           //
23//  You should have received a copy of the GNU General Public License        //
24//  along with this program; if not, write to the Free Software              //
25//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
26//  ------------------------------------------------------------------------ //
27
28if (!defined('XOOPS_ROOT_PATH') || !is_object($xoopsModule)) {
29    exit();
30}
31$com_modid = $xoopsModule->getVar('mid');
32include_once XOOPS_ROOT_PATH."/class/xoopslists.php";
33include_once XOOPS_ROOT_PATH."/class/xoopsformloader.php";
34$cform = new XoopsThemeForm(_CM_POSTCOMMENT, "commentform", 'comment_post.php');if (isset($xoopsModuleConfig['com_rule'])) {
35    include_once XOOPS_ROOT_PATH.'/include/comment_constants.php';
36    switch ($xoopsModuleConfig['com_rule']) {
37    case XOOPS_COMMENT_APPROVEALL:
38        $rule_text = _CM_COMAPPROVEALL;
39        break;
40    case XOOPS_COMMENT_APPROVEUSER:
41        $rule_text = _CM_COMAPPROVEUSER;
42        break;
43    case XOOPS_COMMENT_APPROVEADMIN:
44        default:
45        $rule_text = _CM_COMAPPROVEADMIN;
46        break;
47    }
48    $cform->addElement(new XoopsFormLabel(_CM_COMRULES, $rule_text));
49}
50
51$cform->addElement(new XoopsFormText(_CM_TITLE, 'com_title', 50, 255, $com_title), true);
52$icons_radio = new XoopsFormRadio(_MESSAGEICON, 'com_icon', $com_icon);
53$subject_icons = XoopsLists::getSubjectsList();
54
55
56//Added By viva(2005/12/13) --->
57if (!is_object($xoopsUser)) {
58    $cform->addElement(
59                new XoopsFormText(
60                    _CM_POSTER,
61                    'com_poster_name',
62                     20,
63                     60,
64                     $com_poster_name
65                ),
66            true);
67}
68//Added By viva(2005/12/13) <---
69
70
71foreach ($subject_icons as $iconfile) {
72    $icons_radio->addOption($iconfile, '<img src="'.XOOPS_URL.'/images/subject/'.$iconfile.'" alt="" />');
73}
74$cform->addElement($icons_radio);
75$cform->addElement(new XoopsFormDhtmlTextArea(_CM_MESSAGE, 'com_text', $com_text, 10, 50), true);
76$option_tray = new XoopsFormElementTray(_OPTIONS,'<br />');
77
78$button_tray = new XoopsFormElementTray('' ,'&nbsp;');
79
80
81if (is_object($xoopsUser)) {
82    if ($xoopsModuleConfig['com_anonpost'] == 1) {
83        $noname = !empty($noname) ? 1 : 0;
84        $noname_checkbox = new XoopsFormCheckBox('', 'noname', $noname);
85        $noname_checkbox->addOption(1, _POSTANON);
86        $option_tray->addElement($noname_checkbox);
87    }
88    if (false != $xoopsUser->isAdmin($com_modid)) {
89        // show status change box when editing (comment id is not empty)
90        if (!empty($com_id)) {
91            include_once XOOPS_ROOT_PATH.'/include/comment_constants.php';
92            $status_select = new XoopsFormSelect(_CM_STATUS, 'com_status', $com_status);
93            $status_select->addOptionArray(array(XOOPS_COMMENT_PENDING => _CM_PENDING, XOOPS_COMMENT_ACTIVE => _CM_ACTIVE, XOOPS_COMMENT_HIDDEN => _CM_HIDDEN));
94            $cform->addElement($status_select);
95            $button_tray->addElement(new XoopsFormButton('', 'com_dodelete', _DELETE, 'submit'));
96        }
97        $html_checkbox = new XoopsFormCheckBox('', 'dohtml', $dohtml);
98        $html_checkbox->addOption(1, _CM_DOHTML);
99        $option_tray->addElement($html_checkbox);
100    }
101}
102$smiley_checkbox = new XoopsFormCheckBox('', 'dosmiley', $dosmiley);
103$smiley_checkbox->addOption(1, _CM_DOSMILEY);
104$option_tray->addElement($smiley_checkbox);
105$xcode_checkbox = new XoopsFormCheckBox('', 'doxcode', $doxcode);
106$xcode_checkbox->addOption(1, _CM_DOXCODE);
107$option_tray->addElement($xcode_checkbox);
108$br_checkbox = new XoopsFormCheckBox('', 'dobr', $dobr);
109$br_checkbox->addOption(1, _CM_DOAUTOWRAP);
110$option_tray->addElement($br_checkbox);
111
112$cform->addElement($option_tray);
113$cform->addElement(new XoopsFormHidden('com_pid', intval($com_pid)));
114$cform->addElement(new XoopsFormHidden('com_rootid', intval($com_rootid)));
115$cform->addElement(new XoopsFormHidden('com_id', $com_id));
116$cform->addElement(new XoopsFormHidden('com_itemid', $com_itemid));
117$cform->addElement(new XoopsFormHidden('com_order', $com_order));
118$cform->addElement(new XoopsFormHidden('com_mode', $com_mode));
119
120// add module specific extra params
121
122if ('system' != $xoopsModule->getVar('dirname')) {
123    $comment_config = $xoopsModule->getInfo('comments');
124    if (isset($comment_config['extraParams']) && is_array($comment_config['extraParams'])) {
125        $myts =& MyTextSanitizer::getInstance();
126        foreach ($comment_config['extraParams'] as $extra_param) {
127            // This routine is included from forms accessed via both GET and POST
128            if (isset($_POST[$extra_param])) {
129                $hidden_value = $myts->stripSlashesGPC($_POST[$extra_param]);
130            } elseif (isset($_GET[$extra_param])) {
131                $hidden_value = $myts->stripSlashesGPC($_GET[$extra_param]);
132            } else {
133                $hidden_value = '';
134            }
135            $cform->addElement(new XoopsFormHidden($extra_param, htmlspecialchars($hidden_value, ENT_QUOTES)));
136        }
137    }
138}
139$button_tray->addElement(new XoopsFormButton('', 'com_dopreview', _PREVIEW, 'submit'));
140$button_tray->addElement(new XoopsFormButton('', 'com_dopost', _CM_POSTCOMMENT, 'submit'));
141$cform->addElement($button_tray);
142//$cform->addElement(new XoopsFormHiddenToken());
143$cform->display();
144?>
Note: See TracBrowser for help on using the repository browser.