Codechanges for XTC 3.04 for PHP7 compatibility

ATTENTION! before you start doing the same like me:
this is not a complete HowTO because i stopped as payment did not work!!!!

grab mysql.php Wrapper from Sjoerd Maessen version 0.1 Procedural drop in replacement for legacy projects using the MySQL function and put it in your DOCUMENT_ROOT.

inc/xtc_db_connect.inc.php
if( file_exists ($_SERVER[‚DOCUMENT_ROOT‘].“mysql.php“ )){
include($_SERVER[‚DOCUMENT_ROOT‘].“mysql.php“);
}

inc/xtc_redirect.inc.php
replace header(‚Location: ‚ . eregi_replace(„[\r\n]+(.*)$“, „“, $url));
with header(‚Location: ‚ . preg_replace(„/[\r\n]+(.*)$/i“, „“, $url));

inc/xtc_remove-non_numeric.inc.php
replace $var=ereg_replace(‚[^0-9]‘,“,$var);
with $var=preg_replace(‚/[^0-9]/‘,“,$var);

xtc_create_random_value.inc.php
replace if (eregi(‚^[a-z0-9]$‘, $char)) $rand_value .= $char;
with if (preg_match(‚/^[a-z0-9]$/i‘, $char)) $rand_value .= $char;
replace if (eregi(‚^[a-z]$‘, $char)) $rand_value .= $char;
with if (preg_match(‚/^[a-z]$/i‘, $char)) $rand_value .= $char;
replace if (ereg(‚^[0-9]$‘, $char)) $rand_value .= $char;
with if (preg_match(‚/^[0-9]$/i‘, $char)) $rand_value .= $char;

includes/classes/class.inputfilter.php
replace $source = preg_replace(‚/&#(\d+);/me‘, „chr(\1)“, $source); // decimal notation
with
$source = preg_replace_callback(‚/&#(\d+);/m‘, function($m) { return chr(‚\1‘);}, $source); // decimal notation

and $source = preg_replace(‚/&#x([a-f0-9]+);/mei‘, „chr(0x\1)“, $source); // hex notation
with
$source = preg_replace_callback(‚/&#x([a-f0-9]+);/mi‘, function($m) { return chr(hexdec(‚0x‘.$m[1]));}, $source); // hex notation

includes/classes/xtcPrice.php
replace function xtcShowNote($vpeStatus, $vpeStatus = 0) {
with
function xtcShowNote($vpeStatus, $vpeStatus2 = 0) {
$vpeStatus = $vpeStatus2;

and function xtcFormatSpecialGraduated($pID, $sPrice, $pPrice, $format, $vpeStatus = 0, $pID) {
with
function xtcFormatSpecialGraduated($pID, $sPrice, $pPrice, $format, $vpeStatus = 0, $pID2) {
$pID = $pID2;

checkout_confirmation.php
ok, i started to fix $$_SESSION[‚payment‘] with ${$_SESSION[‚payment‘]} because payment was not recognized. now this could be done – BUT paypal-module is not working anymore – paypal request for login does not show up! so i stopped migrating by myself. its a shame, because everything else seems to work.

i can now

a) disable our shop until i will install a complete new one or
b) upgrade to xtc modified if this is possible and not TOO much work
c) or switch back to PHP5 and get hacked again

so, as i see that our articles are not updated anymore anyway, i will just shutdown the shop now as it was not used by any customers anyway (maybe one order in 6 month in the last year…).

good bye, you’ve been our friend for years, but now it’s time to say goodbye!

0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x