/** Lift Ban */ public function actionBanLift($id) { if (!Yii::$app->user->can('app.forum.moderator.ban-lift')) { throw new ForbiddenHttpException(YBoard::t('yboard', 'You have no enough permission to access this page! If you think its a mistake, please consider reporting to us.')); } if (!Yii::$app->request->isAjax) { Yii::$app->end(); } $json = []; $ban = YBoardBan::findOne($id); $ban->setAttribute('expires', time() - 60); //expired one minute ago if ($ban != null && $ban->save()) { $json['success'] = 'yes'; } else { $json['success'] = 'no'; $json['error'] = YBoard::t('yboard', 'Could Not Lift the Ban!'); } echo json_encode($json); Yii::$app->end(); }
/** * Displays a single YBoardBan model. * @param integer $id * @return mixed */ public function actionBanned($id) { $model = YBoardBan::findOne($id); $user = YBoardMember::findOne($model->user_id); $isIP = true; if ($user !== null) { $isIP = false; } if ($model == null) { throw new NotFoundHttpException(YBoard::t('yboard', 'The requested Banned User does not exist.')); } $settings = YBoardSetting::find()->where(['key' => 'email'])->one(); return $this->render('banned', ['model' => $model, 'member' => $user, 'isIp' => $isIP, 'email' => $settings == null ? YBoard::t('board', 'no email') : $settings->value]); }