コード例 #1
0
ファイル: feedback_ajax.php プロジェクト: klr2003/sourceread
function GetList($page = 1)
{
    global $dsql, $aid, $pagesize, $cfg_templeturl;
    $querystring = "select fb.*,mb.userid,mb.face as mface,mb.spacesta,mb.scores from `#@__feedback` fb\r\n                 left join `#@__member` mb on mb.mid = fb.mid where fb.aid='{$aid}' and fb.ischeck='1' order by fb.id desc";
    $row = $dsql->GetOne("select count(*) as dd from `#@__feedback` where aid='{$aid}' and ischeck='1' ");
    $totalcount = empty($row['dd']) ? 0 : $row['dd'];
    $startNum = $pagesize * ($page - 1);
    if ($startNum > $totalcount) {
        echo "参数错误!";
        return $totalcount;
    }
    $dsql->Execute('fb', $querystring . " limit {$startNum}, {$pagesize} ");
    while ($fields = $dsql->GetArray('fb')) {
        if ($fields['userid'] != '') {
            $spaceurl = $GLOBALS['cfg_memberurl'] . '/index.php?uid=' . $fields['userid'];
        } else {
            $spaceurl = '#';
        }
        if ($fields['username'] == '匿名') {
            $spaceurl = '#';
        }
        $fields['bgimg'] = 'cmt-neu.gif';
        $fields['ftypetitle'] = '该用户表示中立';
        if ($fields['ftype'] == 'bad') {
            $fields['bgimg'] = 'cmt-bad.gif';
            $fields['ftypetitle'] = '该用户表示差评';
        } else {
            if ($fields['ftype'] == 'good') {
                $fields['bgimg'] = 'cmt-good.gif';
                $fields['ftypetitle'] = '该用户表示好评';
            }
        }
        $fields['face'] = empty($fields['face']) ? 6 : $fields['face'];
        $fields['msg'] = str_replace('<', '&lt;', $fields['msg']);
        $fields['msg'] = str_replace('>', '&gt;', $fields['msg']);
        $fields['msg'] = Quote_replace($fields['msg']);
        extract($fields, EXTR_OVERWRITE);
        ?>
	<div id="commetmsgs" class="dede_comment">
		<div class='decmt-box'>
		<div class='decmt-title'>
			<span class='moodico'><img src='<?php 
        echo $cfg_templeturl;
        ?>
/images/mood/ico-mood-<?php 
        echo $face;
        ?>
.gif'/></span>
			<span class='username'><a href='<?php 
        echo $spaceurl;
        ?>
'><?php 
        echo $username;
        ?>
</a></span>
			<span class='date'><?php 
        echo GetDateMk($dtime);
        ?>
</span>
			<span>发表</span>
		</div>
		<div class='decmt-act'>
			<span id='goodfb<?php 
        echo $id;
        ?>
'>
				<a href='#goodfb<?php 
        echo $id;
        ?>
' onclick="postBadGood('goodfb',<?php 
        echo $id;
        ?>
);">支持</a>[<?php 
        echo $good;
        ?>
]
			</span>
			<span id='badfb<?php 
        echo $id;
        ?>
'>
				<a href='#badfb<?php 
        echo $id;
        ?>
' onclick="postBadGood('badfb',<?php 
        echo $id;
        ?>
);">反对</a>[<?php 
        echo $bad;
        ?>
]
			</span>
			<span class='quote'>
				<a href='#postform' onclick="quoteCommet('<?php 
        echo $id;
        ?>
');">[引用]</a>
			</span>
		</div>
		<div class='decmt-content'>
			<?php 
        echo $msg;
        ?>
<img src='<?php 
        echo $cfg_templeturl;
        ?>
/images/<?php 
        echo $bgimg;
        ?>
' alt='<?php 
        echo $ftypetitle;
        ?>
' />
		</div>
		</div>
	</div>
<?php 
    }
    return $totalcount;
}
コード例 #2
0
ファイル: feedback_ajax.php プロジェクト: bthtml/web-hwxf
/**
 *  读取列表内容
 *
 * @param     int  $page  页码
 * @return    string
 */
function GetList($page = 1)
{
    global $dsql, $aid, $pagesize, $cfg_templeturl, $cfg_cmspath;
    $querystring = "SELECT fb.*,mb.userid,mb.face as mface,mb.spacesta,mb.scores,mb.sex FROM `#@__feedback` fb\n                 LEFT JOIN `#@__member` mb on mb.mid = fb.mid WHERE fb.aid='{$aid}' AND fb.ischeck='1' ORDER BY fb.id DESC";
    $row = $dsql->GetOne("SELECT COUNT(*) AS dd FROM `#@__feedback` WHERE aid='{$aid}' AND ischeck='1' ");
    $totalcount = empty($row['dd']) ? 0 : $row['dd'];
    $startNum = $pagesize * ($page - 1);
    if ($startNum > $totalcount) {
        echo "参数错误!";
        return $totalcount;
    }
    $dsql->Execute('fb', $querystring . " LIMIT {$startNum}, {$pagesize} ");
    while ($fields = $dsql->GetArray('fb')) {
        if ($fields['userid'] != '') {
            $spaceurl = $GLOBALS['cfg_memberurl'] . '/index.php?uid=' . $fields['userid'];
        } else {
            $spaceurl = '#';
        }
        if ($fields['username'] == '匿名') {
            $spaceurl = '#';
        }
        $fields['bgimg'] = 'cmt-neu.gif';
        $fields['ftypetitle'] = '该用户表示中立';
        if ($fields['ftype'] == 'bad') {
            $fields['bgimg'] = 'cmt-bad.gif';
            $fields['ftypetitle'] = '该用户表示差评';
        } else {
            if ($fields['ftype'] == 'good') {
                $fields['bgimg'] = 'cmt-good.gif';
                $fields['ftypetitle'] = '该用户表示好评';
            }
        }
        if (empty($fields['mface'])) {
            if ($fields['sex'] == "女") {
                $fields['mface'] = $cfg_cmspath . "/member/templets/images/dfgirl.png";
            } else {
                $fields['mface'] = $cfg_cmspath . "/member/templets/images/dfboy.png";
            }
        }
        $fields['face'] = empty($fields['face']) ? 6 : $fields['face'];
        $fields['msg'] = str_replace('<', '&lt;', $fields['msg']);
        $fields['msg'] = str_replace('>', '&gt;', $fields['msg']);
        helper('smiley');
        $fields['msg'] = RemoveXSS(Quote_replace(parseSmileys($fields['msg'], $cfg_cmspath . '/images/smiley')));
        extract($fields, EXTR_OVERWRITE);
        ?>
<div class="decmt-box2">
  <ul>
    <li> <a href='<?php 
        echo $spaceurl;
        ?>
' class='plpic'><img src='<?php 
        echo $mface;
        ?>
'  height='40' width='40'/></a> <span class="title"><a href="<?php 
        echo $spaceurl;
        ?>
"><?php 
        echo $username;
        ?>
</a></span>
      <div class="comment_act"><span class="fl"><?php 
        echo GetDateMk($dtime);
        ?>
发表</span></div>
      <div style="clear:both"><?php 
        echo ubb($msg);
        ?>
</div>
      <div class="newcomment_act"><span class="fr"><span id='goodfb<?php 
        echo $id;
        ?>
'> <a href='#goodfb<?php 
        echo $id;
        ?>
' onclick="postBadGood('goodfb',<?php 
        echo $id;
        ?>
);">支持</a>[<?php 
        echo $good;
        ?>
] </span> <span id='badfb<?php 
        echo $id;
        ?>
'> <a href='#badfb<?php 
        echo $id;
        ?>
' onclick="postBadGood('badfb',<?php 
        echo $id;
        ?>
);">反对</a>[<?php 
        echo $bad;
        ?>
] </span> <span class='quote'>
        <!--<a href='/plus/feedback.php?aid=<?php 
        echo $id;
        ?>
&fid=<?php 
        echo $id;
        ?>
&action=quote'>[引用]</a>-->
        <a href='javascript:ajaxFeedback(<?php 
        echo $id;
        ?>
,<?php 
        echo $id;
        ?>
,"quote");'>[引用]</a> </span></span></div>
    </li>
  </ul>
  <div id="ajaxfeedback_<?php 
        echo $id;
        ?>
"></div>
</div>
<?php 
    }
    return $totalcount;
}