用户名 密码 记住我 还未注册?

核心中评论功能的bug [技术论坛 - bug报告和功能建议]

XOOPS China 讨论区 > XOOPS Core (核心) > bug报告和功能建议 > 核心中评论功能的bug

正在浏览:   1 名游客



 到底部   前一个主题   下一个主题  [无发表权] 请登录或者注册



核心中评论功能的bug
新进会员
注册日期:
2008/5/6 8:01
所属群组:
注册会员
帖子: 5
等级: 1; EXP: 34
HP: 0 / 8
MP: 1 / 88
离线

       我个人认为评论功能的comment_post.php中有个bug:


        例如设置任何人都可以发表评论,在用户登录后对文章评论时,comment_form.php显示‘匿名发表’选项,发表内容时选中该选项,提交后,评论内容中仍然显示用户登录名。我查看源代码,发现comment_post.php中使用了$noname变量(这个是用来表示匿名选项的变量),但是这个变量没有接收$_POST['noname']的值,导致:


 if (!empty($xoopsModuleConfig['com_anonpost']) && !empty($noname)) {

          $uid = 0;

   } else {

           $uid = $xoopsUser->getVar('uid');

  }


登录用户即使选中了‘匿名选项’,$noname没有获得提交值而总是空值,因而总是执行else语句。


修改方法:


在获取提交值位置:


$com_mode = isset($_POST['com_mode']) ? htmlspecialchars(trim($_POST['com_mode']), ENT_QUOTES) : 'flat';

    $com_order = isset($_POST['com_order']) ? intval($_POST['com_order']) : XOOPS_COMMENT_OLD1ST;

    $com_itemid = isset($_POST['com_itemid']) ? intval($_POST['com_itemid']) : 0;

    $com_pid = isset($_POST['com_pid']) ? intval($_POST['com_pid']) : 0;

    $com_rootid = isset($_POST['com_rootid']) ? intval($_POST['com_rootid']) : 0;

    $com_status = isset($_POST['com_status']) ? intval($_POST['com_status']) : 0;

    $dosmiley = (isset($_POST['dosmiley']) && intval($_POST['dosmiley']) > 0) ? 1 : 0;

    $doxcode = (isset($_POST['doxcode']) && intval($_POST['doxcode']) > 0) ? 1 : 0;

    $dobr = (isset($_POST['dobr']) && intval($_POST['dobr']) > 0) ? 1 : 0;

    $dohtml = (isset($_POST['dohtml']) && intval($_POST['dohtml']) > 0) ? 1 : 0;

    $doimage = (isset($_POST['doimage']) && intval($_POST['doimage']) > 0) ? 1 : 0;

    $com_icon = isset($_POST['com_icon']) ? trim($_POST['com_icon']) : '';


加入:$noname = (isset($_POST['noname']) && intval($_POST['noname']) > 0) ? 1 : 0;


2008/6/13 9:36
工具箱 短消息 Email PDF 书签 打印 举报 回顶部


回复: 核心中评论功能的bug
Support Team
注册日期:
2007/7/16 17:06
来自 彭城/上海
所属群组:
网站管理员
注册会员
Dev+Hack
资料整理组
帖子: 498 | 精华: 4
等级: 20; EXP: 62
HP: 0 / 490
MP: 166 / 6243
离线
不知道 128 行

$noname 
= isset($noname) ? intval($noname) : 0;

是不是

2008/6/13 10:21
工具箱 短消息 Email PDF 书签 打印 举报 回顶部


回复: 核心中评论功能的bug
Support Team
注册日期:
2007/7/16 17:06
来自 彭城/上海
所属群组:
网站管理员
注册会员
Dev+Hack
资料整理组
帖子: 498 | 精华: 4
等级: 20; EXP: 62
HP: 0 / 490
MP: 166 / 6243
离线
刚刚请教了楼主一会好像确实有这个问题!

2008/6/13 11:46
工具箱 短消息 Email PDF 书签 打印 举报 回顶部


回复: 核心中评论功能的bug
新进会员
注册日期:
11/1 10:23
来自 China
所属群组:
注册会员
帖子: 8
等级: 1; EXP: 73
HP: 0 / 18
MP: 2 / 3
离线
They could feel konfus you in such a way that, why so many people, which are not, thus realms some pairs <b><a href="http://www.uggboots4me.net">UGG Boots</a> </b>on time of the clearance sale, but I don' once to afford could; t. Do you know why? Because I know, where they buy that inexpensive<a href="http://www.cheapwomenuggboots.net"> <b>Cheap UGG Boots</b></a> loadings, I do not believe konfus or surprise over her. I buy always inexpensive <b><a href="http://www.ghdivstylers.net">GHD Straighteners</a></b> loadings of very reliable children uggs a sales distance on-line straight like those people. Everyone has its own hobby, and my hobby is to collect special inexpensive UGG loadings in the world. <b><a href="http://www.eleganceshoppe.net">louis vuitton outlet</a></b> is one of the few marks, which really live up to its picture. If a woman for leather handbags<b> <a href="http://www.stylish-zone.net">Louis vuitton outlet</a></b> Utah buys, she knows, in order to expect quality of of Louis the Vuitton allotters. Their draft agreement caused a differentiating view, completely like a signing odoriferous substance. This leather handbags is of <b><a href="http://www.buyfinebag.net">louis vuitton outlet</a></b> taiga in its slouchy form rather simply, and it has only some folded detailed description at the front side and some gold claytone hardware and pin, which stress its whole.

11/9 20:30
工具箱 短消息 Email PDF 书签 打印 举报 回顶部


回复: 核心中评论功能的bug
新进会员
注册日期:
11/1 10:23
来自 China
所属群组:
注册会员
帖子: 8
等级: 1; EXP: 73
HP: 0 / 18
MP: 2 / 3
离线

11/9 20:31
工具箱 短消息 Email PDF 书签 打印 举报 回顶部



  [无发表权] 请登录或者注册


可以查看帖子。
不可发帖。
不可回复。
不可编辑自己的帖子。
不可删除自己的帖子。
不可发起投票调查。
不可在投票调查中投票。
不可上传附件。
不可不经审核直接发帖。
不可使用主题类别。
不可使用HTML语法。
不可使用签名档。

[高级搜索]