Jump to content
View in the app

A better way to browse. Learn more.

IPBMafia.ru - поддержка Invision Community, релизы, темы, плагины и приложения

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Возможно ли исправить ошибку в магазине?

Featured Replies

Posted

Время от времени в логах появляется ошибка, говорящая о том, что ее вызвал гость, на подобных страницах:

https://ip-gamers.net/clients/orders/13

Сама ошибка вот:

OutOfRangeException:  (0)
#0 ip-gamers.net/applications/nexus/modules/front/clients/invoices.php(58): IPS\Patterns\_ActiveRecord::load('13')
#1 ip-gamers.net/system/Dispatcher/Dispatcher.php(153): IPS\nexus\modules\front\clients\_invoices->execute()
#2 ip-gamers.net/index.php(13): IPS\_Dispatcher->run()
#3 {main}

Эту ошибку как то возможно исправить?

Если гости не могут покупать в принципе, то добавить             

if ( !\IPS\Member::loggedIn()->member_id )  {
                \IPS\Output::i()->error( 'no_module_permission_guest', '2X215/3', 403, '' );
}

перед строкой 54 (сразу после else).

 

  • Author
15 минут назад, Desti сказал:

if ( !\IPS\Member::loggedIn()->member_id )  {
                \IPS\Output::i()->error( 'no_module_permission_guest', '2X215/3', 403, '' );
}

Так, я это вставил в файл:

Спойлер

image.thumb.png.9c2134cc3ee08fdfc2033cb5323a0222.png

Как теперь проверить, выйдет ли подобная ошибка или нет?

А ну вот: В счетах стали появляться счета от гостей:

image.thumb.png.ddc55835db0a33cbf4494070f41148d1.png

Но ошибка при этом появляться вроде перестала.

Счета от гостей появляться будут, по умолчанию гость может положить товар в корзину, но для покупки нужна регистрация. Возможно, мое решение не самое корректное, может стоит перехватить исключение..

Замените 58-ю строку на это: (а первое исправление удалите)

try
{
	$this->invoice = \IPS\nexus\Invoice::load( \IPS\Request::i()->id );
}
catch ( \OutOfRangeException $e )
{
	\IPS\Output::i()->error( 'node_error', '2X215/7', 404, '' );
}

 

  • Author
14 минут назад, Desti сказал:

Замените 58-ю строку на это: (а первое исправление удалите)

Прости за такой глупый вопрос. Но 58 строка после редактирования или до? Вот в данный момент это фрагмент выглядит так:

if ( \IPS\Member::loggedIn()->member_id )
			{
				try
				{
					$this->invoice = \IPS\nexus\Invoice::loadAndCheckPerms( \IPS\Request::i()->id );
				}
				catch ( \OutOfRangeException $e )
				{
					\IPS\Output::i()->error( 'node_error', '2X215/1', 404, '' );
				}
			}
			else
				if ( !\IPS\Member::loggedIn()->member_id )  {
                \IPS\Output::i()->error( 'no_module_permission_guest', '2X215/3', 403, '' );
}
			{
				/* Prevent the vid key from being exposed in referrers */
				\IPS\Output::i()->sendHeader( "Referrer-Policy: origin" );

				$key = isset( \IPS\Request::i()->key ) ? \IPS\Request::i()->key : ( isset( \IPS\Request::i()->cookie['guestTransactionKey'] ) ? \IPS\Request::i()->cookie['guestTransactionKey'] : NULL );
				$this->invoice = \IPS\nexus\Invoice::load( \IPS\Request::i()->id );

				if( $this->invoice->member->member_id or !$key or !isset( $this->invoice->guest_data['guestTransactionKey'] ) or !\IPS\Login::compareHashes( $key, $this->invoice->guest_data['guestTransactionKey'] ) )
				{
					\IPS\Output::i()->error( 'no_module_permission_guest', '2X215/6', 404, '' );
				}
			}

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Ответить в этой теме...

Последние посетители 0

  • No registered users viewing this page.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.