コード例 #1
0
ファイル: AjaxController.php プロジェクト: ph7pal/momo
 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
0
 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
0
 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
0
ファイル: UserController.php プロジェクト: ph7pal/mei
 /**
  * 用户反馈
  */
 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
0
ファイル: FeedController.php プロジェクト: ph7pal/wedding
 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
0
 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
0
ファイル: feedback.php プロジェクト: agnat/streaming-website
<?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'));