本文整理匯總了PHP中Reports::validate方法的典型用法代碼示例。如果您正苦於以下問題:PHP Reports::validate方法的具體用法?PHP Reports::validate怎麽用?PHP Reports::validate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Reports
的用法示例。
在下文中一共展示了Reports::validate方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: actionReport
/**
* 舉報
*/
public function actionReport()
{
$this->checkLogin();
$data = array();
$type = zmf::filterInput($_POST['t'], 't', 1);
$url = zmf::filterInput($_POST['u'], 't', 1);
$desc = zmf::filterInput($_POST['desc'], 't', 1);
$sid = zmf::filterInput($_POST['k']);
$allowType = array('posts', 'attachments', 'comments', 'question', 'answer', 'poipost', 'poitips');
if (!in_array($type, $allowType)) {
//Forbidden::updateTimes();
$this->jsonOutPut(0, Yii::t('default', 'forbiddenaction'));
}
if (!isset($sid) or !is_numeric($sid)) {
$this->jsonOutPut(0, Yii::t('default', 'selectreporttarget'));
}
$data['uid'] = zmf::uid();
$data['logid'] = $sid;
$data['classify'] = $type;
$data['url'] = $url;
$data['desc'] = $desc;
$data['ip'] = ip2long(Yii::app()->request->userHostAddress);
$data['status'] = Posts::STATUS_STAYCHECK;
$data['cTime'] = zmf::now();
$fm = new Reports();
$fm->attributes = $data;
if ($fm->validate()) {
if ($fm->save()) {
$this->jsonOutPut(1, Yii::t('default', 'reportsuccess'));
}
} else {
$this->jsonOutPut(0, Yii::t('default', 'unkownerror'));
}
}