本文整理汇总了PHP中Feedback::validate方法的典型用法代码示例。如果您正苦于以下问题:PHP Feedback::validate方法的具体用法?PHP Feedback::validate怎么用?PHP Feedback::validate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Feedback
的用法示例。
在下文中一共展示了Feedback::validate方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionFeedback
public function actionFeedback()
{
$content = zmf::val('content', 1);
if (!$content) {
$this->jsonOutPut(0, '内容不能为空哦~');
}
//一个小时内最多只能反馈5条
if (zmf::actionLimit('feedback', '', 5, 3600)) {
$this->jsonOutPut(0, '操作太频繁,请稍后再试');
}
$attr['uid'] = $this->uid;
$attr['type'] = 'web';
$attr['contact'] = zmf::val('email', 1);
$attr['appinfo'] = zmf::val('url', 1);
$attr['sysinfo'] = Yii::app()->request->userAgent;
$attr['content'] = $content;
$model = new Feedback();
$model->attributes = $attr;
if ($model->validate()) {
if ($model->save()) {
$this->jsonOutPut(1, '感谢您的反馈');
} else {
$this->jsonOutPut(1, '感谢您的反馈');
}
} else {
$this->jsonOutPut(0, '反馈失败,请重试');
}
}
示例2: saveFeedback
public function saveFeedback()
{
$validator = Feedback::validate($data = Input::all());
if ($validator->fails()) {
return Response::json(['valid' => false, 'errors' => $validator->errors()]);
}
Feedback::create($data);
return Response::json(['valid' => true, 'message' => Lang::get('larabase.feedback_submitted')]);
Event::fire('feedback.submitted', [$data]);
}
示例3: actionindex
public function actionindex()
{
$model = new Feedback();
if (isset($_POST['Feedback'])) {
$model->attributes = $_POST['Feedback'];
if ($model->validate()) {
$imagePath = ImageUtils::uploadImage($model, 'image');
if ($imagePath) {
$model->image = FeedbackImagesApi::addImage($imagePath);
}
if ($model->save()) {
EmailApi::sendEmail($model->email_id, "FEEDBACK.SUCCESS");
$this->redirect('/feedback/thanks');
}
}
}
$feedbackTopics = new FeedbackTopic();
$this->renderPartial('index', array('model' => $model, 'feedbackTopics' => $feedbackTopics));
}
示例4: actionFeedback
/**
* 用户反馈
*/
public function actionFeedback()
{
$this->checkUser();
$uid = $this->uid;
$attr['uid'] = $uid;
$attr['type'] = $this->appPlatform;
$attr['contact'] = $this->getValue('contact', 0);
$attr['appinfo'] = $this->getValue('appinfo', 0);
$attr['sysinfo'] = $this->getValue('sysinfo', 0);
$attr['content'] = $this->getValue('content', 1);
$model = new Feedback();
$model->attributes = $attr;
if ($model->validate()) {
if ($model->save()) {
$this->output('感谢您的反馈', $this->succCode);
} else {
$this->output('感谢您的反馈', $this->succCode);
}
} else {
$this->output('反馈失败,请重试', $this->errorCode);
}
}
示例5: add
private function add($type = '')
{
$uid = zmf::filterInput(Yii::app()->request->getParam('uid'), 't', 1);
if (!$uid) {
$uid = zmf::uid();
}
if (zmf::config('fbLoginOnly')) {
if (!$uid) {
$this->jsonOutPut(0, Yii::t('default', 'fbLoginOnly'));
}
}
$url = zmf::filterInput(Yii::app()->request->getParam('url'), 't', 1);
$email = zmf::filterInput(Yii::app()->request->getParam('email'), 't', 1);
$content = zmf::filterInput(Yii::app()->request->getParam('content'), 't', 1);
$ip = zmf::filterInput(Yii::app()->request->getParam('ip'), 't', 1);
$appversion = zmf::filterInput(Yii::app()->request->getParam('appversion'), 't', 1);
$os = zmf::filterInput(Yii::app()->request->getParam('os'), 't', 1);
$platform = zmf::filterInput(Yii::app()->request->getParam('platform'), 't', 1);
$time = zmf::filterInput(Yii::app()->request->getParam('time'), 't', 1);
if (!$ip) {
$ip = ip2long(Yii::app()->request->userHostAddress);
}
if (!$platform) {
$platform = Yii::app()->request->getUserAgent();
}
if ($type == '' || !in_array($type, array('pc', 'mobile', 'ios', 'android'))) {
$type = 'pc';
}
if (!$time) {
$time = zmf::now();
}
$cacheKey = 'feedback_' . $ip;
if ($content == '') {
$this->jsonOutPut(0, Yii::t('default', 'fbNoEmpty'));
}
if (zmf::config('fbTimesLimit')) {
$times = intval(zmf::getFCache($cacheKey));
$_time = $times + 1;
//fbLimitTimes
zmf::setFCache($cacheKey, $_time, 60);
if ($_time >= zmf::config('fbLimitTimes')) {
$this->jsonOutPut(0, Yii::t('default', 'fbTimesLimit'));
}
}
$data = array('uid' => $uid, 'url' => $url, 'email' => $email, 'content' => $content, 'ip' => $ip, 'cTime' => $time, 'status' => Posts::STATUS_STAYCHECK, 'classify' => $type, 'appversion' => $appversion, 'os' => $os, 'platform' => $platform);
$model = new Feedback();
$model->attributes = $data;
if ($model->validate()) {
if ($model->save()) {
if (zmf::config("defaultNoticeUid")) {
$_data = array('uid' => zmf::config("defaultNoticeUid"), 'content' => ($email != '' ? $email . '反馈:' : '新反馈:') . $content, 'type' => 'feedback', 'from_id' => rand(1, 100000), 'from_idtype' => 'feedback');
Notification::add($_data);
}
$this->jsonOutPut(1, Yii::t('default', 'fbThanking'));
} else {
$this->jsonOutPut(0, Yii::t('default', 'fbThanking'));
}
} else {
$this->jsonOutPut(0, Yii::t('default', 'notvalidate'));
}
}
示例6: actionFeedback
public function actionFeedback()
{
$model = new Feedback();
if (isset($_POST['Feedback'])) {
$model->attributes = $_POST['Feedback'];
if ($model->validate()) {
$model->savedata();
Yii::app()->user->setFlash("feedbackpost", 'Appreciate your feedback.');
$this->redirect(array('site/feedback'));
}
}
$this->render('feedback', array('model' => $model));
}
示例7: Feedback
<?php
$feedback = new Feedback();
if (!$feedback->isEnabled()) {
throw new NotFoundException('Feedback is disabled');
}
$info = $_POST;
if ($feedback->validate($info)) {
$feedback->store($info);
header('Content-Type: application/json');
echo json_encode(true);
exit;
}
echo $tpl->render(array('page' => 'feedback', 'title' => 'Give Feedback'));