Skip to content

Commit

Permalink
Fix package image
Browse files Browse the repository at this point in the history
  • Loading branch information
samerton committed Jul 10, 2022
1 parent c47c5b1 commit 2fbf2ba
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
12 changes: 11 additions & 1 deletion upload/modules/Tebex/pages/panel/packages.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,22 @@

$description = EventHandler::executeEvent('renderTebexContentEdit', ['content' => $package->description ?? ''])['content'];

if (isset($package->image) && $package->image) {
if (strpos($package->image, 'https') !== false) {
$image = Output::getClean($package->image);
} else {
$image = (defined('CONFIG_PATH') ? CONFIG_PATH . '/' : '/') . 'uploads/store/' . Output::getClean($package->image);
}
} else {
$image = null;
}

$smarty->assign(array(
'PACKAGE_NAME' => Output::getClean(Output::getDecoded($package->name)),
'EDITING_PACKAGE' => $buycraft_language->get('language', 'editing_package', ['package' => Output::getClean($package->name)]),
'PACKAGE_DESCRIPTION' => $buycraft_language->get('language', 'package_description'),
'PACKAGE_IMAGE' => $buycraft_language->get('language', 'package_image'),
'PACKAGE_IMAGE_VALUE' => (isset($package->image) ? ((defined('CONFIG_PATH') ? CONFIG_PATH . '/' : '/') . 'uploads/store/' . Output::getClean($package->image)) : null),
'PACKAGE_IMAGE_VALUE' => $image,
'UPLOAD_NEW_IMAGE' => $buycraft_language->get('language', 'upload_new_image'),
'BROWSE' => $language->get('general', 'browse'),
'BACK' => $language->get('general', 'back'),
Expand Down
10 changes: 9 additions & 1 deletion upload/modules/Tebex/pages/store/category.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,15 @@
foreach ($packages as $package) {
$content = EventHandler::executeEvent('renderTebexContent', ['content' => $package->description ?? ''])['content'];

$image = (isset($package->image) && $package->image ? ((defined('CONFIG_PATH') ? CONFIG_PATH . '/' : '/') . 'uploads/store/' . Output::getClean($package->image)) : null);
if (isset($package->image) && $package->image) {
if (strpos($package->image, 'https') !== false) {
$image = Output::getClean($package->image);
} else {
$image = (defined('CONFIG_PATH') ? CONFIG_PATH . '/' : '/') . 'uploads/store/' . Output::getClean($package->image);
}
} else {
$image = null;
}

$category_packages[] = array(
'id' => Output::getClean($package->id),
Expand Down

0 comments on commit 2fbf2ba

Please sign in to comment.