home *** CD-ROM | disk | FTP | other *** search
/ Cricao de Sites - 650 Layouts Prontos / WebMasters.iso / CMS / xoops-2.0.18.1.exe / xoops-2.0.18.1 / htdocs / include / comment_form.php < prev    next >
Encoding:
PHP Script  |  2006-05-27  |  6.4 KB  |  127 lines

  1. <?php
  2. // $Id: comment_form.php 506 2006-05-26 23:10:37Z skalpa $
  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.  
  28. if (!defined('XOOPS_ROOT_PATH') || !is_object($xoopsModule)) {
  29.     exit();
  30. }
  31. $com_modid = $xoopsModule->getVar('mid');
  32. include_once XOOPS_ROOT_PATH."/class/xoopslists.php";
  33. include_once XOOPS_ROOT_PATH."/class/xoopsformloader.php";
  34. $cform = new XoopsThemeForm(_CM_POSTCOMMENT, "commentform", 'comment_post.php', 'post', true);
  35. if (isset($xoopsModuleConfig['com_rule'])) {
  36.     include_once XOOPS_ROOT_PATH.'/include/comment_constants.php';
  37.     switch ($xoopsModuleConfig['com_rule']) {
  38.     case XOOPS_COMMENT_APPROVEALL:
  39.         $rule_text = _CM_COMAPPROVEALL;
  40.         break;
  41.     case XOOPS_COMMENT_APPROVEUSER:
  42.         $rule_text = _CM_COMAPPROVEUSER;
  43.         break;
  44.     case XOOPS_COMMENT_APPROVEADMIN:
  45.         default:
  46.         $rule_text = _CM_COMAPPROVEADMIN;
  47.         break;
  48.     }
  49.     $cform->addElement(new XoopsFormLabel(_CM_COMRULES, $rule_text));
  50. }
  51.  
  52. $cform->addElement(new XoopsFormText(_CM_TITLE, 'com_title', 50, 255, $com_title), true);
  53. $icons_radio = new XoopsFormRadio(_MESSAGEICON, 'com_icon', $com_icon);
  54. $subject_icons = XoopsLists::getSubjectsList();
  55. foreach ($subject_icons as $iconfile) {
  56.     $icons_radio->addOption($iconfile, '<img src="'.XOOPS_URL.'/images/subject/'.$iconfile.'" alt="" />');
  57. }
  58. $cform->addElement($icons_radio);
  59. $cform->addElement(new XoopsFormDhtmlTextArea(_CM_MESSAGE, 'com_text', $com_text, 10, 50), true);
  60. $option_tray = new XoopsFormElementTray(_OPTIONS,'<br />');
  61.  
  62. $button_tray = new XoopsFormElementTray('' ,' ');
  63.  
  64.  
  65. if (is_object($xoopsUser)) {
  66.     if ($xoopsModuleConfig['com_anonpost'] == 1) {
  67.         $noname = !empty($noname) ? 1 : 0;
  68.         $noname_checkbox = new XoopsFormCheckBox('', 'noname', $noname);
  69.         $noname_checkbox->addOption(1, _POSTANON);
  70.         $option_tray->addElement($noname_checkbox);
  71.     }
  72.     if (false != $xoopsUser->isAdmin($com_modid)) {
  73.         // show status change box when editing (comment id is not empty)
  74.         if (!empty($com_id)) {
  75.             include_once XOOPS_ROOT_PATH.'/include/comment_constants.php';
  76.             $status_select = new XoopsFormSelect(_CM_STATUS, 'com_status', $com_status);
  77.             $status_select->addOptionArray(array(XOOPS_COMMENT_PENDING => _CM_PENDING, XOOPS_COMMENT_ACTIVE => _CM_ACTIVE, XOOPS_COMMENT_HIDDEN => _CM_HIDDEN));
  78.             $cform->addElement($status_select);
  79.             $button_tray->addElement(new XoopsFormButton('', 'com_dodelete', _DELETE, 'submit'));
  80.         }
  81.         $html_checkbox = new XoopsFormCheckBox('', 'dohtml', $dohtml);
  82.         $html_checkbox->addOption(1, _CM_DOHTML);
  83.         $option_tray->addElement($html_checkbox);
  84.     }
  85. }
  86. $smiley_checkbox = new XoopsFormCheckBox('', 'dosmiley', $dosmiley);
  87. $smiley_checkbox->addOption(1, _CM_DOSMILEY);
  88. $option_tray->addElement($smiley_checkbox);
  89. $xcode_checkbox = new XoopsFormCheckBox('', 'doxcode', $doxcode);
  90. $xcode_checkbox->addOption(1, _CM_DOXCODE);
  91. $option_tray->addElement($xcode_checkbox);
  92. $br_checkbox = new XoopsFormCheckBox('', 'dobr', $dobr);
  93. $br_checkbox->addOption(1, _CM_DOAUTOWRAP);
  94. $option_tray->addElement($br_checkbox);
  95.  
  96. $cform->addElement($option_tray);
  97. $cform->addElement(new XoopsFormHidden('com_pid', intval($com_pid)));
  98. $cform->addElement(new XoopsFormHidden('com_rootid', intval($com_rootid)));
  99. $cform->addElement(new XoopsFormHidden('com_id', $com_id));
  100. $cform->addElement(new XoopsFormHidden('com_itemid', $com_itemid));
  101. $cform->addElement(new XoopsFormHidden('com_order', $com_order));
  102. $cform->addElement(new XoopsFormHidden('com_mode', $com_mode));
  103.  
  104. // add module specific extra params
  105.  
  106. if ('system' != $xoopsModule->getVar('dirname')) {
  107.     $comment_config = $xoopsModule->getInfo('comments');
  108.      if (isset($comment_config['extraParams']) && is_array($comment_config['extraParams'])) {
  109.         $myts =& MyTextSanitizer::getInstance();
  110.         foreach ($comment_config['extraParams'] as $extra_param) {
  111.             // This routine is included from forms accessed via both GET and POST
  112.             if (isset($_POST[$extra_param])) {
  113.                 $hidden_value = $myts->stripSlashesGPC($_POST[$extra_param]);
  114.             } elseif (isset($_GET[$extra_param])) {
  115.                 $hidden_value = $myts->stripSlashesGPC($_GET[$extra_param]);
  116.             } else {
  117.                 $hidden_value = '';
  118.             }
  119.              $cform->addElement(new XoopsFormHidden($extra_param, $hidden_value));
  120.          }
  121.      }
  122. }
  123. $button_tray->addElement(new XoopsFormButton('', 'com_dopreview', _PREVIEW, 'submit'));
  124. $button_tray->addElement(new XoopsFormButton('', 'com_dopost', _CM_POSTCOMMENT, 'submit'));
  125. $cform->addElement($button_tray);
  126. $cform->display();
  127. ?>