refs #5: Added support for showing the actual Source Guardian license error
This commit is contained in:
parent
e2935ea5b0
commit
66e5c187be
@ -46,6 +46,23 @@ if (strtolower($_SERVER['REQUEST_METHOD']) == 'post' && isset($_FILES['upload-li
|
|||||||
}
|
}
|
||||||
/* END UPLOAD PROCESSING */
|
/* END UPLOAD PROCESSING */
|
||||||
|
|
||||||
|
/* START LICENSE ERROR */
|
||||||
|
$licenseError = null;
|
||||||
|
if (isset($_GET['licerror']))
|
||||||
|
{
|
||||||
|
$licenseErrorNumber = intval($_GET['licerror']);
|
||||||
|
|
||||||
|
if (isset($lang['license_errors'][$licenseErrorNumber]))
|
||||||
|
{
|
||||||
|
$licenseError = $lang['license_errors'][$licenseErrorNumber];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$licenseError = $lang['license_errors'][99];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* END LICENSE ERROR */
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
?>
|
?>
|
||||||
|
|
||||||
@ -59,6 +76,11 @@ ob_start();
|
|||||||
<p><?php echo $uploadError; ?></p>
|
<p><?php echo $uploadError; ?></p>
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
<?php if (!is_null($licenseError)): ?>
|
||||||
|
<div class="alert alert-danger">
|
||||||
|
<p><?php echo $licenseError; ?></p>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
<form action="license-required.php" method="post" enctype="multipart/form-data">
|
<form action="license-required.php" method="post" enctype="multipart/form-data">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="control-label"><?php echo $lang['upload_license_label']; ?></label>
|
<label class="control-label"><?php echo $lang['upload_license_label']; ?></label>
|
||||||
|
@ -2,6 +2,17 @@
|
|||||||
return [
|
return [
|
||||||
'app_name' => 'Blue Twilight - Install',
|
'app_name' => 'Blue Twilight - Install',
|
||||||
'copyright' => sprintf('© %s <a href="http://www.andyheathershaw.uk/" target="_blank">Andy Heathershaw</a>.', (date('Y') == 2016 ? 2016 : '2016-' . date('Y'))),
|
'copyright' => sprintf('© %s <a href="http://www.andyheathershaw.uk/" target="_blank">Andy Heathershaw</a>.', (date('Y') == 2016 ? 2016 : '2016-' . date('Y'))),
|
||||||
|
'license_errors' => [
|
||||||
|
1 => 'The application is not licensed to run on this machine or domain.',
|
||||||
|
2 => 'The application is not licensed to run on this machine or domain.',
|
||||||
|
3 => 'The application is not licensed to run on this machine or domain.',
|
||||||
|
6 => 'The license file provided is invalid.',
|
||||||
|
7 => 'This version of PHP is not supported. Please upgrade to a supported version of PHP or contact support.',
|
||||||
|
9 => 'The application/license has expired.',
|
||||||
|
13 => 'No license is currently available.',
|
||||||
|
20 => 'The application requires an Internet connection that was not available.',
|
||||||
|
99 => 'An unexpected error occurred, please contact support.'
|
||||||
|
],
|
||||||
'license_required_p1' => 'Blue Twilight requires a license to run correctly. You can generate and download a license file from the <a href="http://shop.andyheathershaw.uk/user/orders" target="_blank">My Orders</a> page.',
|
'license_required_p1' => 'Blue Twilight requires a license to run correctly. You can generate and download a license file from the <a href="http://shop.andyheathershaw.uk/user/orders" target="_blank">My Orders</a> page.',
|
||||||
'license_required_p2' => 'Your license file must match the hostname: :host_name.',
|
'license_required_p2' => 'Your license file must match the hostname: :host_name.',
|
||||||
'license_required_title' => 'License Required',
|
'license_required_title' => 'License Required',
|
||||||
|
@ -1,6 +1,24 @@
|
|||||||
<?php
|
<?php
|
||||||
function btw_license_error($code, $message)
|
function btw_license_error($code, $message)
|
||||||
{
|
{
|
||||||
|
// Remove an invalid license file - relevant to index.php as that's the main entry script
|
||||||
|
$licenseFile = sprintf('%s/blue-twilight.lic', dirname(__DIR__));
|
||||||
|
|
||||||
|
if (file_exists($licenseFile))
|
||||||
|
{
|
||||||
|
$number = 0;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
$backupFilename = sprintf('%s_invalid.%d', $licenseFile, $number++);
|
||||||
|
} while (file_exists($backupFilename));
|
||||||
|
|
||||||
|
// Rename or remove the file
|
||||||
|
if (!rename($licenseFile, $backupFilename))
|
||||||
|
{
|
||||||
|
@unlink($licenseFile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
header(sprintf('Location: license-required.php?licerror=%d', $code));
|
header(sprintf('Location: license-required.php?licerror=%d', $code));
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@ system(sprintf('rm -rf %s/tests', $appRoot));
|
|||||||
|
|
||||||
echo 'Licensing and encoding the application using Source Guardian...' . PHP_EOL . PHP_EOL;
|
echo 'Licensing and encoding the application using Source Guardian...' . PHP_EOL . PHP_EOL;
|
||||||
$sgCommand = sprintf(
|
$sgCommand = sprintf(
|
||||||
'/usr/local/sourceguardian/bin/sourceguardian --phpversion "5.6" --external "%s" --projid "%s" --projkey "%s" ' .
|
'/usr/local/sourceguardian/bin/sourceguardian --phpversion "5.6" --phpversion "7.0" --external "%s" --projid "%s" --projkey "%s" ' .
|
||||||
'--stop-on-error --strict-errors --deprec-errors -x "*.blade.php" -x "vendor/*.php" -x "public/raw/*.php" ' .
|
'--stop-on-error --strict-errors --deprec-errors -x "*.blade.php" -x "vendor/*.php" -x "public/raw/*.php" ' .
|
||||||
'-x public/license-required.php -x public/loader-required.php -x "storage/*" -r -b- ' .
|
'-x public/license-required.php -x public/loader-required.php -x "storage/*" -r -b- ' .
|
||||||
'-p @./public/raw/sg-license-error.php -j "<?php btw_loader_error(); ?>" --catch ERR_ALL="btw_license_error" "*.php"',
|
'-p @./public/raw/sg-license-error.php -j "<?php btw_loader_error(); ?>" --catch ERR_ALL="btw_license_error" "*.php"',
|
||||||
|
Loading…
Reference in New Issue
Block a user