| Server IP : 208.122.213.31 / Your IP : 216.73.216.45 Web Server : Apache System : Linux msd6191.mjhst.com 4.18.0-553.137.1.el8_10.x86_64 #1 SMP Wed Jun 24 11:40:24 UTC 2026 x86_64 User : WHMCS_MIA_382 ( 1001) PHP Version : 7.4.33 Disable Function : NONE MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/httpd/html/classicscash.com/public_html/cms_admin/ |
Upload File : |
<?php
/**
* Fix Elevated X Templates for PHP 7.2
*
* This script will go through and attempt to correct for common problems with our templates and PHP 7.2.
*
* We HIGHLY recommend you or your host back up your template folders before running this script.
*
* PHP version 5.6 to 7.2
*
* LICENSE: This source file is subject to the Elevated X license
* that is available through the world-wide-web at the following URI:
* https://www.elevatedx.com/terms.php. If you did not receive a copy of
* the PHP License and are unable to obtain it through the web, please
* send a note to sales@elevatedx.com so we can mail you a copy immediately.
*
* @category Tools
* @package ElevatedXCMS
* @copyright 2018 Elevated X, Inc.
* @license https://www.elevatedx.com/terms.php
* @link https://www.elevatedx.com/
*/
if (sizeof($argv) != "2")
{
echo "Usage:\n\n";
echo "php fix_templates_php72.php [FILENAME]\n";
echo "php fix_templates_php72.php [DIRECTORY]\n";
echo "\n\n";
exit;
}
if (!file_exists($argv[1]))
{
echo "ERROR: " . $argv[1] . " does not exist";
exit;
}
if (is_dir($argv[1]))
{
$Directory = new RecursiveDirectoryIterator($argv[1]);
$Iterator = new RecursiveIteratorIterator($Directory);
$lst = new RegexIterator($Iterator, '/^.+\.tpl$/i', RecursiveRegexIterator::GET_MATCH);
}
else
{
$lst = [$argv[1]];
}
foreach
($lst as $l)
{
$l = (is_array($l)) ? $l[0] : $l;
echo "\nFile: $l";
if (basename($l) == "tour_tag_list.tpl") continue;
$tokens = token_get_all( file_get_contents($l) );
$out = "";
// These are instances of strings / functions that will get replaced.
$token_string_replace = [
"sizeof" => "array_not_empty",
"count" => "array_not_empty",
];
// These are individual strings within the standard templates that will get corrected.
$string_replace = [
'$root.page.paginate' => 'true',
'$root.page_attr[0].mobileswap' => '$mobileswap',
'$category_selected[\'Title\'] == Tags' => '$category_selected[\'Title\'] == "Tags"',
'"class" =>category_model_thumb' => '"class" => "category_model_thumb"',
'"class" => dvd_box' => '"class" => "dvd_box"',
];
// tag_list.tpl has different token replacement and string replacement than other files.
if (basename($l) == "tag_list.tpl")
{
$string_replace = [
'if (!sizeof($count))' => 'if (!$count)',
];
$token_string_replace = [];
}
foreach ($tokens as $token)
{
if (is_array($token))
{
if (token_name($token[0]) == "T_STRING" && isset($token_string_replace[$token[1]]))
{
echo "\n CHANGE " . $token[1] . " to " . $token_string_replace[$token[1]];
$out .= $token_string_replace[$token[1]];
}
else
{
//echo "\n$l Line {$token[2]}: " . token_name($token[0]) . " ({$token[1]})";
$out .= $token[1];
}
}
else
{
// echo "\nNON-ARRAY TOKEN:";
// var_dump($token);
$out .= $token;
}
}
foreach
($string_replace as $string_from => $string_to)
{
if (stripos($out, $string_from) !== false)
{
$out = str_replace($string_from, $string_to, $out);
echo "\n CHANGE " . $string_from . " to " . $string_to;
}
}
if (!file_put_contents($l, $out))
{
echo "\nERROR: File $l cannot be written to disk. Please check file permissions";
}
}
echo "\n\n";
exit;