本文整理汇总了PHP中error_popup函数的典型用法代码示例。如果您正苦于以下问题:PHP error_popup函数的具体用法?PHP error_popup怎么用?PHP error_popup使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了error_popup函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
*
* @return mixed
*/
public function handle($request, Closure $next)
{
if ($this->auth->check() && $this->auth->user()->isRestricted()) {
return error_popup(trans('errors.no_restricted_access'));
}
return $next($request);
}
示例2: update
public function update($id)
{
$order = Store\Order::findOrFail($id);
if ($order->status !== 'paid') {
return error_popup("order status {$order->status} is invalid.");
}
$order->unguard();
$order->update(Request::input('order'));
$order->save();
return ['message' => "order {$id} updated"];
}
示例3: updateProfileCover
public function updateProfileCover()
{
if (Request::hasFile('cover_file') && !Auth::user()->osu_subscriber) {
return error_popup(trans('errors.supporter_only'));
}
try {
Auth::user()->profileCustomization()->firstOrCreate([])->setCover(Request::input('cover_id'), Request::file('cover_file'));
} catch (ImageProcessorException $e) {
return error_popup($e->getMessage());
}
return Auth::user()->defaultJson();
}
示例4: vote
public function vote($id)
{
$discussion = BeatmapDiscussion::findOrFail($id);
priv_check('BeatmapDiscussionVote', $discussion)->ensureCan();
$params = get_params(Request::all(), 'beatmap_discussion_vote', ['score:int']);
$params['user_id'] = Auth::user()->user_id;
if ($discussion->vote($params)) {
return $discussion->beatmapsetDiscussion->defaultJson(Auth::user());
} else {
return error_popup(trans('beatmaps.discussion-votes.update.error'));
}
}
示例5: update
public function update($id)
{
$cover = ForumCover::findOrFail($id);
if (Request::hasFile('cover_file') === true) {
try {
$cover = $cover->updateFile(Request::file('cover_file')->getRealPath(), Auth::user());
} catch (ImageProcessorException $e) {
return error_popup($e->getMessage());
}
}
return fractal_item_array($cover, new ForumCoverTransformer());
}
示例6: register
public function register($id)
{
$tournament = Tournament::findOrFail($id);
$user = Auth::user();
if (!$tournament->isRegistrationOpen()) {
return error_popup('registrations are closed!');
}
if (!$tournament->isValidRank($user)) {
return error_popup('invalid rank!');
}
$tournament->register($user);
return ujs_redirect("/tournaments/{$id}");
}
示例7: update
public function update($id)
{
$cover = TopicCover::findOrFail($id);
priv_check('ForumTopicCoverEdit', $cover)->ensureCan();
if (Request::hasFile('cover_file') === true) {
try {
$cover = $cover->updateFile(Request::file('cover_file')->getRealPath(), Auth::user());
} catch (ImageProcessorException $e) {
return error_popup($e->getMessage());
}
}
return json_item($cover, new TopicCoverTransformer());
}
示例8: updateProfileCover
public function updateProfileCover()
{
if (Request::hasFile('cover_file') && !Auth::user()->osu_subscriber) {
abort(403);
}
$customization = Auth::user()->profileCustomization()->firstOrNew([]);
$customization->setCover($errors, Request::input('cover_id'), Request::file('cover_file'));
if (count($errors) === 0) {
return Auth::user()->defaultJson();
} else {
return error_popup(implode(',', $errors));
}
}
示例9: update
public function update($orderId, $orderItemId)
{
$item = Store\OrderItem::findOrFail($orderItemId);
if ($item->order_id !== (int) $orderId) {
return error_popup('invalid order id for this item.');
}
if ($item->order->status !== 'paid') {
return error_popup("order status {$item->order->status} is invalid.");
}
$item->unguard();
$item->update(Request::input('item'));
$item->save();
return ['message' => "order item {$orderItemId} updated"];
}
示例10: login
public function login()
{
$ip = Request::getClientIp();
$username = Request::input('username');
$password = Request::input('password');
$remember = Request::input('remember') === 'yes';
$user = User::findForLogin($username);
$authError = User::attemptLogin($user, $password, $ip);
if ($authError === null) {
Request::session()->flush();
Request::session()->regenerateToken();
Auth::login($user, $remember);
return ['header' => render_to_string('layout._header_user'), 'header_popup' => render_to_string('layout._popup_user'), 'user' => Auth::user()->defaultJson()];
} else {
return error_popup($authError);
}
}
示例11: login
public function login()
{
$ip = Request::getClientIp();
if (LoginAttempt::isLocked($ip)) {
return error_popup("your IP address is locked. Please wait a few minutes.");
} else {
$username = Request::input("username");
$password = Request::input("password");
$remember = Request::input("remember") === "yes";
Auth::attempt(['username' => $username, 'password' => $password], $remember);
if (Auth::check()) {
return Auth::user();
} else {
LoginAttempt::failedAttempt($ip, $username);
return error_popup("wrong password or username");
}
}
}
示例12: login
public function login()
{
$ip = Request::getClientIp();
if (LoginAttempt::isLocked($ip)) {
return error_popup('your IP address is locked. Please wait a few minutes.');
} else {
$username = Request::input('username');
$password = Request::input('password');
$remember = Request::input('remember') === 'yes';
Auth::attempt(['username' => $username, 'password' => $password], $remember);
if (Auth::check()) {
return Auth::user()->defaultJson();
} else {
LoginAttempt::failedAttempt($ip, $username);
return error_popup('wrong password or username');
}
}
}
示例13: postSlackAgree
public function postSlackAgree()
{
$user = Auth::user();
if ($user->isSlackEligible() === false) {
return error_popup(trans('errors.community.slack.not-eligible'));
}
$token = config('slack.token');
$contents = file_get_contents("https://osu-public.slack.com/api/users.admin.invite?email={$user->user_email}&token={$token}&set_active=true");
if ($contents === false) {
return error_popup(trans('errors.community.slack.slack-error'));
}
$contents = json_decode($contents, true);
if ($contents['ok'] === true) {
$user->slackUser()->create([]);
return ['ok' => true];
} else {
return error_popup(trans(trans('errors.community.slack.slack-error')));
}
}
示例14: store
public function store()
{
$discussion = BeatmapDiscussion::findOrNew(Request::input('beatmap_discussion_id'));
$isNewDiscussion = $discussion->id === null;
if ($isNewDiscussion) {
$beatmapsetDiscussion = BeatmapsetDiscussion::where('beatmapset_id', Request::input('beatmapset_id'))->firstOrFail();
$discussion->beatmapset_discussion_id = $beatmapsetDiscussion->id;
}
$posts = [new BeatmapDiscussionPost($this->postParams($discussion))];
$previousDiscussionResolved = $discussion->resolved;
$discussion->fill($this->discussionParams($isNewDiscussion));
priv_check('BeatmapDiscussionPost', $discussion)->ensureCan();
if ($discussion->resolved === true) {
priv_check('BeatmapDiscussionResolve', $discussion)->ensureCan();
}
if (!$isNewDiscussion && $discussion->resolved !== $previousDiscussionResolved) {
$posts[] = BeatmapDiscussionPost::generateLogResolveChange(Auth::user(), $discussion->resolved);
}
try {
$saved = DB::transaction(function () use($posts, $discussion) {
if ($discussion->save() === false) {
throw new Exception('failed');
}
foreach ($posts as $post) {
// done here since discussion may or may not previously exist
$post->beatmap_discussion_id = $discussion->id;
if ($post->save() === false) {
throw new Exception('failed');
}
}
return true;
});
} catch (Exception $_e) {
$saved = false;
}
$postIds = array_pluck($posts, 'id');
if ($saved === true) {
return ['beatmapset_discussion' => $posts[0]->beatmapsetDiscussion->defaultJson(Auth::user()), 'beatmap_discussion_post_ids' => $postIds, 'beatmap_discussion_id' => $discussion->id];
} else {
return error_popup(trans('beatmaps.discussion-posts.store.error'));
}
}
示例15: login
public function login()
{
$ip = Request::getClientIp();
if (LoginAttempt::isLocked($ip)) {
return error_popup('your IP address is locked. Please wait a few minutes.');
} else {
$usernameOrEmail = Request::input('username');
$user = User::where('username', $usernameOrEmail)->orWhere('user_email', $usernameOrEmail)->first();
$password = Request::input('password');
$remember = Request::input('remember') === 'yes';
$validAuth = $user === null ? false : Auth::getProvider()->validateCredentials($user, compact('password'));
if ($validAuth) {
Request::session()->flush();
Request::session()->regenerateToken();
Auth::login($user, $remember);
return ['header' => render_to_string('layout._header_user', ['_user' => Auth::user()]), 'header_popup' => render_to_string('layout._popup_user', ['_user' => Auth::user()]), 'user' => Auth::user()->defaultJson()];
} else {
LoginAttempt::failedAttempt($ip, $user);
return error_popup('wrong password or email');
}
}
}