XMB Forum Software

[Resolved] XMB 1.9.12 BETA

Xian - 9-16-2017 at 04:50 AM

Full Board URL: http://forums.xmbforum2.com
XMB Version: 1.9.11

New Install

Read the documentation inside the package and follow installation as normal

--------------------------------------------------

Upgrade instructions for hacked boards.

--------------------------------------------------

DISCLAIMER

THIS SOFTWARE MODIFICATION IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

***USE AT YOUR OWN RISK***

***PLEASE TEST OUT THE MODIFICATIONS FIRST TO MAKE SURE IT WORKS ON THE SERVER YOU ARE INSTALLING IT ON.***

***MAKE BACKUPS OF YOUR EXISTING FILES AND DATABASE SO YOU CAN REVERT BACK TO THE PRE MODIFIED VERSION OF YOUR XMB INSTALLATION***

--------------------------------------------------
Tested on a Windows Dev Server running:

Apache: 2.4.27
MariaDB: 10.1.26
PHP: 7.1.8
--------------------------------------------------
Tested on a Linux Production Server running:

Apache: 2.4.25
MySQL: 5.5.57-cll
PHP: 5.6.30
--------------------------------------------------

1. Backup your existing XMB installation first. -> Download your entire "XMB" folder.

2. Backup your existing MySQL database via phpMyAdmin.

3. BACKUP EVERYTHING!!

4. Upload ./db/mysqli.php to your .ROOT./db/ folder

5. Upload ./include/schema.inc.php to your .ROOT./include/ folder

6. Open your config.php file.

7. Change $database = 'mysql'; to $database = 'mysqli';

8. Save the new config file.

9. Did I already mention to backup your files and database? Well did you do it?

10. If you did a complete backup good for you! Enjoy!

****~~~KNOWN BUGS~~~****
None at this time.

Please report bugs here.


--------------- Patched ---------------

Avatars with https:// are now allowed.
http://forums.xmbforum2.com/viewthread.php?tid=776998

-----------------------------------------


Jenny Lee - 9-16-2017 at 10:08 AM

Apparently there is some sort of formatting error in function phpShorthandValue. Server using PHP 7.1.8, also tested on 5.6(no errors were present).

screenshotoferror.PNG - 17kB

lottos - 9-16-2017 at 10:14 AM

Not unique to XMB 1.9.12 BETA but may as well link to it:

http://forums.xmbforum2.com/viewthread.php?tid=776998

Jenny Lee - 9-16-2017 at 10:33 AM

Quote: Originally posted by lottos  
Not unique to XMB 1.9.12 BETA

Yeah, it's also present 1.9.11. Either way, since it's a notice, you could probably get rid of displaying the error via ini_settings, but that doesn't really solve the problem. I'd like to have all warnings on.

Scarlet - 9-16-2017 at 12:44 PM

Nice thing linking to my thread I made earlier ;)

Xian - 9-16-2017 at 03:08 PM

The fix for this: http://forums.xmbforum2.com/viewthread.php?tid=776998

Has been applied to the download in the original post and file download.

Xian - 9-16-2017 at 03:15 PM

Quote: Originally posted by lottos  
Not unique to XMB 1.9.12 BETA but may as well link to it:

http://forums.xmbforum2.com/viewthread.php?tid=776998


Could you try this:

1. Open ./include/functions.inc.php

2. Find:

function phpShorthandValue($ininame) {
$rawstring = trim(ini_get($ininame));
$rchr = strtoupper(substr($rawstring, -1));
switch ($rchr) {
case 'G':
$rawstring *= 1073741824;
break;
case 'M':
$rawstring *= 1048576;
break;
case 'K':
$rawstring *= 1024;
break;
default:
$rawstring = intval($rawstring);
break;
}
return $rawstring;
}

3. Change to:

/*
function phpShorthandValue($ininame) {
$rawstring = trim(ini_get($ininame));
$rchr = strtoupper(substr($rawstring, -1));
switch ($rchr) {
case 'G':
$rawstring *= 1073741824;
break;
case 'M':
$rawstring *= 1048576;
break;
case 'K':
$rawstring *= 1024;
break;
default:
$rawstring = intval($rawstring);
break;
}
return $rawstring;
}
*/

4. Add below that:

function phpShorthandValue($ininame) {
$rawstring = trim(ini_get($ininame));
if (is_string($rawstring)) {
switch (substr($rawstring, -1)) {
case 'M': case 'm': return (int) $rawstring * 1048576;
case 'K': case 'k': return (int) $rawstring * 1024;
case 'G': case 'g': return (int) $rawstring * 1073741824;
}
}
return (int) $rawstring;
}

5. Save file.

6. Test

Please let me know how it goes.

Jenny Lee - 9-16-2017 at 05:02 PM


That's how I fixed it for myself, yet I'm not sure what this function is used for in order to properly test it, but value is being returned the same as in non edited version of PHP 5.:)

function phpShorthandValue($ininame) {
$rawstring = trim(ini_get($ininame));
$rchr = strtoupper(substr($rawstring, -1));
$rawstring = (integer)$rawstring;
switch ($rchr) {
case 'G':
$rawstring *= 1073741824;
break;
case 'M':
$rawstring *= 1048576;
break;
case 'K':
$rawstring *= 1024;
break;
default:
$rawstring = intval($rawstring);
break;
}
return $rawstring;
}

Either way, thanks for your code too.:thumbup: I might double check the output of both fixes, but if responses are identical I think my way is a bit less messy as far as code goes.

Xian - 9-16-2017 at 05:09 PM

Have a look here:

http://phpcrossref.com/xref/xmb/_functions/phpshorthandvalue...

The header.php file:

// Validate maxattachsize with PHP configuration.
$inimax = phpShorthandValue('upload_max_filesize');
if ($inimax < $SETTINGS['maxattachsize']) {
$maxattachsize = $inimax;
$SETTINGS['maxattachsize'] = $inimax;
}
unset($inimax);

Uses the function to validate filesize uploads to make sure that it doesn't exceed what is in the forum settings.

And referenced 3 times in post.php

$maxtotal = phpShorthandValue('post_max_size');
if ($maxtotal > 0) {
$lang['attachmaxtotal'] .= ' '.getSizeFormatted($maxtotal);
} else {
$lang['attachmaxtotal'] = '';
}

As post attachment validations.

Jenny Lee - 9-16-2017 at 05:20 PM

Nice, now I can actually test it out. Thanks for the pointers.;)

Xian - 9-16-2017 at 05:29 PM

No problem!


Jenny Lee - 9-16-2017 at 06:50 PM

Alright, I wrote a little script to test that mess. As suspected, original throws an error while other two works just fine. I have attached the script, so you could test it for yourself.:)
Use $_GET['size'] for testing custom values, but this is optional.:frog:

2017-09-16_19-39-22.png - 17kB
Attachment: test.php (2kB)
This file has been downloaded 629 times

Scarlet - 9-16-2017 at 08:27 PM

Since Jenny says her way is a cleaner piece of code I'll probably fix that with my own board before I finally upgrade the server to PHP 7. Just a quick question, how do I upgrade from 5.6 to 7.0 on Debian 8 Jessie? I don't want to break anything if I try reading tutorials and such and I know I can trust the XMB Community. :D

lottos - 9-16-2017 at 10:04 PM

Xian, do you think we should have a number system for the beta? Just in case people who aren't following this topic download from sourceforge may think the beta is the same, whereas it's already changed I think 3 times?

eg: 1.9.12.2


Jenny Lee - 9-16-2017 at 10:15 PM

Quote: Originally posted by Scarlet  
Since Jenny says her way is a cleaner piece of code I'll probably fix that with my own board before I finally upgrade the server to PHP 7.


I don't recommend using those fixes, because none of those those 3 functions(including original) were convenient enough. If user uses two letter format (MB, KB, GB) instead of one( M,K,G) current functions just bails out or shows complete gibberish.:frog:

Use the one from fix.php attached to this post :)

Attachment: fix.php (662B)
This file has been downloaded 579 times

In regards of php upgrading, you most likely need to use a package manager.
Something like apt-get install php7.1 should do.
P.S. If it does nothing you need to add repositories manually, I think.

Xian - 9-16-2017 at 10:45 PM

Quote: Originally posted by lottos  
Xian, do you think we should have a number system for the beta? Just in case people who aren't following this topic download from sourceforge may think the beta is the same, whereas it's already changed I think 3 times?

eg: 1.9.12.2



LOL! You're right. Let's number them like that. I will update them when I get home.

lottos - 9-17-2017 at 03:08 AM

A few pre-existing pre .12 beta bugs listed here:
https://bugs.xmbforum2.com/my_view_page.php

Xian - 9-17-2017 at 04:10 AM

Quote: Originally posted by lottos  
A few pre-existing pre .12 beta bugs listed here:
https://bugs.xmbforum2.com/my_view_page.php


Thanks for the link! I will see what I can do with some of them.

Scarlet - 9-18-2017 at 06:58 AM

http://forums.xmbforum2.com/viewthread.php?tid=776966

Would be nice if this feature could be done or perhaps made a hack, seeing as most forum software has it.