📄 review.php
字号:
<?
class CModule extends CUserApp
{
function execute()
{
$aSoft = new CSoft;
$aSoft->open();
if(!$aSoft->find($this->input[id])) $this->showmsg("要查看的目标ID非法!", "");
$aSoft->close();
if($this->input[action] == "addReview") $this->addReview();
else $this->showReview();
}
function addReview()
{
if(empty($this->input[user_name])) $this->showMsg("对不起,评论人姓名不好为空,请重新填写。");
if(empty($this->input[review_comment])) $this->showMsg("对不起,评论的内容不可为空,请重新填写。");
if(strlen($this->input[review_comment])> 200) $this->showMsg("对不起,您发表评论的内容不可超过200个字符,请重新填写。");
$review_comment = stripslashes($this->input[review_comment]);
$review_comment = $this->safeChars($review_comment);
$aReview = new CReview;
$aReview->open();
$aReview->appendNew();
$aReview->soft_id = $this->input[id];
$aReview->review_point = $this->input[review_point];
$aReview->review_comment = $review_comment;
$aReview->user_name = $this->input[user_name];
$aReview->review_time = date("Y-m-d H:i:s");
$aReview->review_title = $this->input[review_title];
$aReview->update();
$aReview->close();
$this->showmsg("恭喜,您的评论已成功发出,多谢!", "index.php?modules=review&id={$this->input[id]}");
}
function showReview()
{
$aReview = new CReview;
$aReview->open();
$posList = $aReview->FilterBySoft($this->input[id]);
$perpage = $this->set[pagenumReview];
$reviewcount = count($posList);
$page = $this->input[page];
if ($page == "") $page = 1;
$total = ceil(count($posList) / $perpage);
if($total > intval($total)) {$total++;}
$total = intval($total);
$start = ($page-1) * $perpage;
$num = count($posList) - $perpage * ($page - 1);
if($num > $perpage) $num = $perpage;
$points = 0;
for($i = 0; $i < $num; $i++)
{
$aReview->setAbsolutePosition($posList[$i + $start]);
$points += $aReview->review_point;
eval ("\$reviews .= \"".$this->getTemplate("reviewBody")."\";");
}
for($i = 1; $i <= $total; $i++)
if($i != $page) $pages .= "<a href = 'index.php?modules=review&id={$this->input[id]}&page=$i'>[$i]</a>";
else $pages .= "<font color=red>[$i]</font>";
$header = $this->Header("查看/发表评论");
eval("\$this->output(\"".$this->getTemplate("review")."\", \"N\");");
$aReview->close();
}
}//end class
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -