本文整理汇总了PHP中error_popup函数的典型用法代码示例。如果您正苦于以下问题:PHP error_popup函数的具体用法?PHP error_popup怎么用?PHP error_popup使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了error_popup函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:Bobo1239,项目名称:osu-web,代码行数:15,代码来源:CheckUserRestricted.php
示例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"];
}
开发者ID:avail,项目名称:osu-web,代码行数:11,代码来源:OrderController.php
示例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();
}
开发者ID:avail,项目名称:osu-web,代码行数:12,代码来源:AccountController.php
示例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'));
}
}
开发者ID:ppy,项目名称:osu-web,代码行数:12,代码来源:BeatmapDiscussionsController.php
示例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());
}
开发者ID:nanaya,项目名称:osu-web,代码行数:12,代码来源:ForumCoversController.php
示例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}");
}
开发者ID:echojc,项目名称:osu-web,代码行数:13,代码来源:TournamentsController.php
示例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());
}
开发者ID:ameliaikeda,项目名称:osu-web,代码行数:13,代码来源:TopicCoversController.php
示例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));
}
}
开发者ID:NiHikKi,项目名称:osu-web,代码行数:13,代码来源:AccountController.php
示例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"];
}
开发者ID:ppy,项目名称:osu-web,代码行数:14,代码来源:OrderItemsController.php
示例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);
}
}
开发者ID:ppy,项目名称:osu-web,代码行数:17,代码来源:UsersController.php
示例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");
}
}
}
开发者ID:WiiPlayer2,项目名称:osu-web,代码行数:18,代码来源:UsersController.php
示例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');
}
}
}
开发者ID:avail,项目名称:osu-web,代码行数:18,代码来源:UsersController.php
示例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')));
}
}
开发者ID:ameliaikeda,项目名称:osu-web,代码行数:19,代码来源:CommunityController.php
示例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'));
}
}
开发者ID:ameliaikeda,项目名称:osu-web,代码行数:42,代码来源:BeatmapDiscussionPostsController.php
示例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');
}
}
}
开发者ID:ameliaikeda,项目名称:osu-web,代码行数:22,代码来源:UsersController.php
示例16: scores
public function scores($id)
{
$beatmap = Beatmap::findOrFail($id);
$mode = Request::input('mode', Beatmap::modeStr($beatmap->playmode));
$mods = Request::input('enabledMods');
$type = Request::input('type', 'global');
$user = Auth::user();
if (!is_array($mods)) {
$mods = [];
}
if ($type !== 'global' || !empty($mods)) {
if ($user === null || !$user->isSupporter()) {
return error_popup(trans('errors.supporter_only'));
}
}
try {
$query = $beatmap->scoresBest($mode)->defaultListing()->with('user');
} catch (\InvalidArgumentException $ex) {
return error_popup($ex->getMessage());
}
$query->withMods($mods);
switch ($type) {
case 'country':
$query->fromCountry($user->country_acronym);
break;
case 'friend':
$query->friendsOf($user);
break;
}
$scoresList = json_collection($query->get(), new ScoreTransformer(), 'user');
if ($user !== null) {
$score = (clone $query)->where('user_id', $user->user_id)->first();
if ($score !== null) {
$userScore = json_item($score, new ScoreTransformer(), 'user');
$userScorePosition = 1 + (clone $query)->limit(null)->where('score', '>', $score->score)->count();
}
}
return ['scoresList' => $scoresList, 'userScore' => $userScore ?? null, 'userScorePosition' => $userScorePosition ?? null];
}
开发者ID:ppy,项目名称:osu-web,代码行数:39,代码来源:BeatmapsController.php
示例17: updateProfile
public function updateProfile()
{
if (Request::hasFile('cover_file') && !Auth::user()->osu_subscriber) {
return error_popup(trans('errors.supporter_only'));
}
if (Request::hasFile('cover_file') || Request::has('cover_id')) {
try {
Auth::user()->profileCustomization()->firstOrCreate([])->setCover(Request::input('cover_id'), Request::file('cover_file'));
} catch (ImageProcessorException $e) {
return error_popup($e->getMessage());
}
}
if (Request::has('order')) {
$order = Request::input('order');
$error = 'errors.account.profile-order.generic';
// Checking whether the input has the same amount of elements
// as the master sections array.
if (count($order) !== count(UserProfileCustomization::$sections)) {
return error_popup(trans($error));
}
// Checking if any section that was sent in input
// also appears in the master sections arrray.
foreach ($order as $i) {
if (!in_array($i, UserProfileCustomization::$sections, true)) {
return error_popup(trans($error));
}
}
// Checking whether the elements sent in input do not repeat.
$occurences = array_count_values($order);
foreach ($occurences as $i) {
if ($i > 1) {
return error_popup(trans($error));
}
}
Auth::user()->profileCustomization()->firstOrCreate([])->setExtrasOrder($order);
}
return Auth::user()->defaultJson();
}
开发者ID:Bobo1239,项目名称:osu-web,代码行数:38,代码来源:AccountController.php
示例18: postAddToCart
public function postAddToCart()
{
$result = $this->userCart()->updateItem(Request::input("item", []), true);
if ($result[0]) {
return ujs_redirect('/store/cart');
} else {
return error_popup($result[1]);
}
}
开发者ID:WiiPlayer2,项目名称:osu-web,代码行数:9,代码来源:StoreController.php
示例19: voteFeature
public function voteFeature($topicId)
{
$star = FeatureVote::createNew(['user_id' => Auth::user()->user_id, 'topic_id' => $topicId]);
if ($star->getKey() !== null) {
return ujs_redirect(route('forum.topics.show', $topicId));
} else {
return error_popup(implode(' ', $star->validationErrors()->allMessages()));
}
}
开发者ID:ameliaikeda,项目名称:osu-web,代码行数:9,代码来源:TopicsController.php
示例20: verify
public function verify()
{
if ($this->isDone()) {
return $this->verified();
}
$expireDate = $this->request->session()->get('verification_expire_date');
$tries = $this->request->session()->get('verification_tries');
$key = $this->request->session()->get('verification_key');
if (!present($expireDate) || !present($tries) || !present($key)) {
$this->issue();
return error_popup(trans('user_verification.errors.expired'));
}
if ($expireDate->isPast()) {
$this->issue();
return error_popup(trans('user_verification.errors.expired'));
}
if ($tries > config('osu.user.verification_key_tries_limit')) {
$this->issue();
return error_popup(trans('user_verification.errors.retries_exceeded'));
}
if (str_replace(' ', '', $this->request->input('verification_key')) !== $key) {
$this->request->session()->put('verification_tries', $tries + 1);
return error_popup(trans('user_verification.errors.incorrect_key'));
}
return $this->verified();
}
开发者ID:ppy,项目名称:osu-web,代码行数:26,代码来源:UserVerification.php
注:本文中的error_popup函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论