WebDev

SMF Arcade => SMF Arcade Support + Plugins => Topic started by: addlife on March 24, 2019, 03:19:33 pm

Title: Error after installing
Post by: addlife on March 24, 2019, 03:19:33 pm
Hi I installed the mod from this site.

When clicking on the arcade admin settings to edit games, manage installations, and manage uploads it gives me this error

"Too few arguments to function mb_substr(), 2 passed in /home/xyz1/public_html/Sources/Subs-ArcadeAdmin.php on line 2244 and exactly 3 expected"

my site is 001002.xyz
and I attached the file mentioned

Any ideas how I can fix it?
Thanks.
Title: Re: Error after installing
Post by: addlife on March 27, 2019, 03:15:46 pm
Quote from: addlife on March 24, 2019, 03:19:33 pmHi I installed the mod from this site.

When clicking on the arcade admin settings to edit games, manage installations, and manage uploads it gives me this error

"Too few arguments to function mb_substr(), 2 passed in /home/xyz1/public_html/Sources/Subs-ArcadeAdmin.php on line 2244 and exactly 3 expected"

my site is 001002.xyz
and I attached the file mentioned

Any ideas how I can fix it?
Thanks.
I'm reinstalling SMF on the site. So as of now it's not up. I plan on having it the same way. I'll see if the error still comes up
Title: Re: Error after installing
Post by: Chen Zhen on March 28, 2019, 12:32:16 am

If I remember correctly, substr was swapped out with mb_substr a while back but the length parameter was not added.
Odd thing is that I do not get this error.

The PHP manual shows that length and char encoding have defaults if not included.
ref. https://www.php.net/manual/en/function.mb-substr.php

I attached your file with that function edited to include the length parameter.

What PHP version are you using?
Title: Re: Error after installing
Post by: addlife on March 29, 2019, 04:36:33 pm
Quote from: Chen Zhen on March 28, 2019, 12:32:16 amIf I remember correctly, substr was swapped out with mb_substr a while back but the length parameter was not added.
Odd thing is that I do not get this error.

The PHP manual shows that length and char encoding have defaults if not included.
ref. https://www.php.net/manual/en/function.mb-substr.php

I attached your file with that function edited to include the length parameter.

What PHP version are you using?
Thanks for responding.

Sites on php version 7.1

I'm non techie so I'm not very familiar with the jargon.

Now the error is the same but says on line 2161
Title: Re: Error after installing
Post by: Chen Zhen on April 08, 2019, 10:49:11 pm

I had forgotten that long ago I created a custom mb_substr function where PHP found it did not exist.
That custom function requires the length parameter which I neglected to include in some circumstances.

The problem for you is that the arcade has evolved and now relies on various multibyte functions.
This should not be a problem though as most host/server control panels allow enabling that extension.

Are you using Cpanel?

If so, try this...

How to Enable mbstring in cPanel

1) Login to cPanel.

2) Go to the section 'Software'.

3) Click the icon 'Select PHP Version'

4) Select the php extension 'mbstring'.

5) Click the button 'Save'.



If you do not see the option and have support for your website, I suggest writing them a ticket & ask for the mbstring extension to be enabled.

Either way, let me know if the problem is resolved or if you need further assistance.
Title: Re: Error after installing
Post by: addlife on April 12, 2019, 05:50:35 pm

Thanks that fixed it.

Although now when I upload a game pack and install it through the admin section the games don't show up. I downloaded the smf gamepacks from invision. I tried 2 different gamepacks and the same thing happes. After installing it just disappears from all lists in the admin section and doesn't either show up on the arcade page either.

Although in cpanel I can see it in the games folder.

I'm getting two errors in error log

Code Select
http://001002.xyz/index.php?action=admin;area=managegames;sa=main;dda83f97bf6=76902c6ab5738584641c10b8fab50d79

8: Undefined variable: allDirs

File: /home/xyz1/public_html/Sources/Subs-ArcadeAdmin.php
Line: 2656

and

Code Select
http://001002.xyz/index.php?action=admin;area=managegames;sa=main;dda83f97bf6=76902c6ab5738584641c10b8fab50d79

2: in_array() expects parameter 2 to be array, null given

File: /home/xyz1/public_html/Sources/Subs-ArcadeAdmin.php
Line: 2656
Title: Re: Error after installing
Post by: Chen Zhen on April 12, 2019, 10:27:20 pm
Which gamepacks?
I will need to see an example for testing.

The undefined errors were due to me neglecting to define an array prior to using it.
This will be fixed in the next version release (already done to the beta).

I attached the admin file.
It is actually for the upcoming version but it should work for the version you are using.

Delete the concerned gamepacks from your Games directory.
Else try these 2 arcade maintenance options:
Quote from: undefinedPurge /home/napalmz0/public_html/Games Directory Of Compressed Archives
Purge /home/napalmz0/public_html/Games Directory Of Unused Game Folders


Try it again and let me know if you still have the same problem.
Title: Re: Error after installing
Post by: addlife on April 14, 2019, 12:28:35 am
I replaced my subs-arcadeadmin file with the one you posted.

I tested it out with this classics gamepack
http://invisiongames.org/forum/index.php?download=10557

I still have the same problem. It doesn't show up after installing. Could it be that I'm missing something basic like enabling a permission or something?


BTW I'm ecited to hear that you're working on an update :)
Title: Re: Error after installing
Post by: Chen Zhen on April 14, 2019, 01:06:08 am
Please download & use the attached file instead since there was a problem with the last file.



The problem is not with the arcade but with the gamepack format.
The author of the gamepack compressed a folder filled with other compressed archives.
This gamepack is likely made for IBP arcade installation and not really geared for SMF Arcade.

Since those gamepacks include some games not available in gamepacks here in the download section,
I will set them up properly and make them available.

Other gamepacks are available for the time being:
https://web-develop.ca/index.php?action=downloads;area=stable_smf_arcade_gamepacks
Title: Re: Error after installing
Post by: addlife on April 14, 2019, 01:50:44 am
I don't see any gamepacks available for download on that link. It takes me to the regular download page with all your other downloads.
Title: Re: Error after installing
Post by: addlife on April 14, 2019, 01:56:27 am
Oh actually I see you have a ton of games on your arcade with an option to download them. But I need 5 posts. Don't mind me spamming this thread  :P
Title: Re: Error after installing
Post by: addlife on April 14, 2019, 01:57:22 am
Hopefully the last post padding post. Thanks
Title: Re: Error after installing
Post by: addlife on April 14, 2019, 04:29:57 am
So I'm back again :)

I downloaded 3 single html5 games from your arcade.

Digger, p2-ball, and onslaught arena. This time it gives me this error when trying to install them

Too few arguments to function installGames(), 1 passed in /home/xyz1/public_html/Sources/ManageGames.php on line 432 and at least 2 expected

I'm on mobile so I'll try to upload the file tomorrow if you need it.

Thanks for taking your time to help :)
Title: Re: Error after installing
Post by: Chen Zhen on April 14, 2019, 09:41:10 pm

The function requires 3 arguments but it is being called using two arguments.
This shouldn't matter because the function's 3rd argument has a default of false.

Anyhow, you can do this edit to that file..
find:
Code Select
$_SESSION['qaction_data'] = installGames($install, $setCategory);

replace with:
Code Select
$_SESSION['qaction_data'] = installGames($install, $setCategory, false);

I tested installing those games on a local site and they work fine for me.
 
Title: Re: Error after installing
Post by: addlife on April 15, 2019, 01:57:14 pm
Thanks so much. That fixed it, now the games are working.



BTW the arcade page when logged in looks very neat and orderly. I'm assuming it's the updated file you gave me.
Title: Re: Error after installing
Post by: addlife on April 15, 2019, 02:09:44 pm
Actually I only got p2 ball and digger to install. When trying to install arena onslaught it gives me an error of "unable to read read .tar file"

I'll try to figure it out.
Title: Re: Error after installing
Post by: addlife on April 15, 2019, 03:14:56 pm
Quote from: addlife on April 15, 2019, 02:09:44 pmActually I only got p2 ball and digger to install. When trying to install arena onslaught it gives me an error of "unable to read read .tar file"

I'll try to figure it out.
Just a little background to my previous post. I downloaded those 3 games then uploaded them using the admin section of the arcade. Then when I went to install them the actual file name (i.e. html5_p2ball.tar.gz) was on the list of games and not the game name (p2-ball).

Somehow when trying to install it and it errored out on me (this was before I made the edits to managegames.php) the game name started showing up. And in my cpanel file manager the game was in a folder.



Anyways now what I tried doing was extracting the .tar.gz game file to a new folder. Now the game name shows up on the list and I'm able to install it. But when I go to play the game I can only get to the title screen of the game. When I click play it just blacks out and nothing displays.

I'll continue trying to do random things that most probably are totally wrong to try to fix it  :P
Title: Re: Error after installing
Post by: Chen Zhen on April 15, 2019, 06:24:53 pm

You do not need to fool with any files via FTP or CPanel concerning installing games.
Tar compression (and its PEAR requirement if necessary) is provided by the arcade.
However, gzip compression will require the zlib extension within PHP.

Try changing the save type being provided by the arcade.
Go to the arcade & click on the "ARCHIVE" button, after which you can select another file type.
Try TAR or ZIP (not tar.gz).
The arcade will save the preference for your user id.
Title: Re: Error after installing
Post by: addlife on April 16, 2019, 02:54:08 am
Yes that worked. Thanks

Just a quick side question, on my test site the arcade screen looks all neat and orderly on mobile or desktop

Screenshot_20190416-023200.png
Screenshot_20190416-024803.png


While on my main site it looks all messy on mobile

Screenshot_20190416-023227.png


I think I used the same admin file you uploaded before. I'm not sure what's making those changes.

How can I change it to the nicer format?
Title: Re: Error after installing
Post by: Chen Zhen on April 16, 2019, 07:27:14 pm
There are skin and list settings in the arcade admin and within the user profile.
In the admin you set the default skin and list settings (these are optional templates/styles).
A user with permission can set the skin and list to what they want which is saved to the database.

If you don't want a user to be able to adjust those settings then you go into your forum permissions and disable "Edit Arcade Settings" for that membergroup.
If you do that then the membergroup will only see the default setup.
EhPortal 1.24 © 2018, WebDev