1: <?php
2: 3: 4: 5: 6: 7: 8: 9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22: function b_legacy_comments_show($options) {
23: $block = array();
24: include_once XOOPS_ROOT_PATH.'/include/comment_constants.php';
25: $comment_handler =& xoops_gethandler('comment');
26: $criteria = new CriteriaCompo(new Criteria('com_status', XOOPS_COMMENT_ACTIVE));
27: $criteria->setLimit(intval($options[0]));
28: $criteria->setSort('com_created');
29: $criteria->setOrder('DESC');
30: $comments =& $comment_handler->getObjects($criteria, true);
31: $member_handler =& xoops_gethandler('member');
32: $module_handler =& xoops_gethandler('module');
33: $modules =& $module_handler->getObjects(new Criteria('hascomments', 1), true);
34: $comment_config = array();
35: foreach (array_keys($comments) as $i) {
36: $mid = $comments[$i]->getVar('com_modid');
37: $com['module'] = '<a href="'.XOOPS_URL.'/modules/'.$modules[$mid]->getVar('dirname').'/">'.$modules[$mid]->getVar('name').'</a>';
38: if (!isset($comment_config[$mid])) {
39: $comment_config[$mid] = $modules[$mid]->getInfo('comments');
40: }
41: $com['id'] = $i;
42: $com['title'] = '<a href="'.XOOPS_URL.'/modules/'.$modules[$mid]->getVar('dirname').'/'.$comment_config[$mid]['pageName'].'?'.$comment_config[$mid]['itemName'].'='.$comments[$i]->getVar('com_itemid').'&com_id='.$i.'&com_rootid='.$comments[$i]->getVar('com_rootid').'&'.htmlspecialchars($comments[$i]->getVar('com_exparams')).'#comment'.$i.'">'.$comments[$i]->getVar('com_title').'</a>';
43: $com['icon'] = $comments[$i]->getVar('com_icon');
44: $com['icon'] = ($com['icon'] != '') ? $com['icon'] : 'icon1.gif';
45: $com['time'] = $comments[$i]->getVar('com_created');
46: if ($comments[$i]->getVar('com_uid') > 0) {
47: $poster =& $member_handler->getUser($comments[$i]->getVar('com_uid'));
48: if (is_object($poster)) {
49: $com['poster'] = '<a href="'.XOOPS_URL.'/userinfo.php?uid='.$comments[$i]->getVar('com_uid').'">'.$poster->getVar('uname').'</a>';
50: } else {
51: $com['poster'] = $GLOBALS['xoopsConfig']['anonymous'];
52: }
53: } else {
54: $com['poster'] = $GLOBALS['xoopsConfig']['anonymous'];
55: }
56: $block['comments'][] =& $com;
57: unset($com);
58: }
59: return $block;
60: }
61:
62: function b_legacy_comments_edit($options) {
63: $inputtag = "<input type='text' name='options[]' value='".intval($options[0])."' />";
64: $form = sprintf(_MB_LEGACY_DISPLAYC, $inputtag);
65: return $form;
66: }
67: ?>
68: