当前位置: 首页>>代码示例>>PHP>>正文


PHP Feedback::validate方法代码示例

本文整理汇总了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, '反馈失败,请重试');
     }
 }
开发者ID:ph7pal,项目名称:momo,代码行数:28,代码来源:AjaxController.php

示例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]);
 }
开发者ID:pogliozzy,项目名称:larabase,代码行数:10,代码来源:PagesController.php

示例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));
 }
开发者ID:romeo14,项目名称:wallfeet,代码行数:19,代码来源:FeedbackController.php

示例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);
     }
 }
开发者ID:ph7pal,项目名称:mei,代码行数:25,代码来源:UserController.php

示例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'));
     }
 }
开发者ID:ph7pal,项目名称:wedding,代码行数:61,代码来源:FeedController.php

示例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));
 }
开发者ID:rgummadi,项目名称:ScriptOverflow,代码行数:13,代码来源:SiteController.php

示例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'));
开发者ID:agnat,项目名称:streaming-website,代码行数:14,代码来源:feedback.php


注:本文中的Feedback::validate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。