Xian
Member
 
Posts: 50
Registered: 9-12-2017
Location: Los Angeles, California
Member Is Offline
Mood: w00h00!
|
|
[Resolved] XMB 1.9.12 BETA
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
Member
 
Posts: 36
Registered: 7-21-2017
Location: England, UK
Member Is Offline
Mood: Meh.
|
|
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).

|
|
lottos
Administrator
      
Posts: 482
Registered: 6-3-2002
Member Is Offline
Mood: pass me a TimTam
|
|
|
|
Jenny Lee
Member
 
Posts: 36
Registered: 7-21-2017
Location: England, UK
Member Is Offline
Mood: Meh.
|
|
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
Member
 
Posts: 60
Registered: 9-15-2017
Location: England
Member Is Offline
Mood: Excited for XMB's resurrection!
|
|
Nice thing linking to my thread I made earlier 
|
|
Xian
Member
 
Posts: 50
Registered: 9-12-2017
Location: Los Angeles, California
Member Is Offline
Mood: w00h00!
|
|
|
|
Xian
Member
 
Posts: 50
Registered: 9-12-2017
Location: Los Angeles, California
Member Is Offline
Mood: w00h00!
|
|
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
Member
 
Posts: 36
Registered: 7-21-2017
Location: England, UK
Member Is Offline
Mood: Meh.
|
|
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.  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
Member
 
Posts: 50
Registered: 9-12-2017
Location: Los Angeles, California
Member Is Offline
Mood: w00h00!
|
|
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
Member
 
Posts: 36
Registered: 7-21-2017
Location: England, UK
Member Is Offline
Mood: Meh.
|
|
Nice, now I can actually test it out. Thanks for the pointers. 
|
|
Xian
Member
 
Posts: 50
Registered: 9-12-2017
Location: Los Angeles, California
Member Is Offline
Mood: w00h00!
|
|
No problem!
|
|
Jenny Lee
Member
 
Posts: 36
Registered: 7-21-2017
Location: England, UK
Member Is Offline
Mood: Meh.
|
|
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.

Attachment: test.php (2kB) This file has been downloaded 625 times
|
|
Scarlet
Member
 
Posts: 60
Registered: 9-15-2017
Location: England
Member Is Offline
Mood: Excited for XMB's resurrection!
|
|
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. 
|
|
lottos
Administrator
      
Posts: 482
Registered: 6-3-2002
Member Is Offline
Mood: pass me a TimTam
|
|
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
Member
 
Posts: 36
Registered: 7-21-2017
Location: England, UK
Member Is Offline
Mood: Meh.
|
|
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.
Use the one from fix.php attached to this post
Attachment: fix.php (662B) This file has been downloaded 572 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
Member
 
Posts: 50
Registered: 9-12-2017
Location: Los Angeles, California
Member Is Offline
Mood: w00h00!
|
|
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
Administrator
      
Posts: 482
Registered: 6-3-2002
Member Is Offline
Mood: pass me a TimTam
|
|
|
|
Xian
Member
 
Posts: 50
Registered: 9-12-2017
Location: Los Angeles, California
Member Is Offline
Mood: w00h00!
|
|
Thanks for the link! I will see what I can do with some of them.
|
|
Scarlet
Member
 
Posts: 60
Registered: 9-15-2017
Location: England
Member Is Offline
Mood: Excited for XMB's resurrection!
|
|
|
|