From 8ee883adadabb93cb79260f1409d6d22a1dc19cd Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Fri, 14 Oct 2016 13:02:02 -0400 Subject: [PATCH] Update for not finding package. If you don't find the package then don't try to call the object. --- package.php | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/package.php b/package.php index c9eb9ab..c030267 100644 --- a/package.php +++ b/package.php @@ -5,24 +5,26 @@ $package_id = filter_var($_REQUEST['package_id'], FILTER_VALIDATE_INT); if ( $package_id ) { $package = Toolkit_Packages_Package::fetchById( - Toolkit_Database::getInstance(), + Toolkit_Database::getInstance(), $package_id ); - $output = '
' - . '
'; - $output .='

' . $package->getTitle() . '

'; - if ( $package->getImage() ) { - $output .= ''; + if ( is_object( $package ) && $package instanceof Toolkit_Packages_Package ) { + $output = '
' + . '
'; + $output .='

' . $package->getTitle() . '

'; + if ( $package->getImage() ) { + $output .= ''; + } + $output .= '
'; + $output .= '
'.$package->getSavings().'
'; + $output .= '
'.$package->getDateRange().'
'; + $output .= '
'; + $output .= $package->getDescription(); + $output .= '
'; + $output .= '
'; } - $output .= '
'; - $output .= '
'.$package->getSavings().'
'; - $output .= '
'.$package->getDateRange().'
'; - $output .= '
'; - $output .= $package->getDescription(); - $output .= '
'; - $output .= '
'; } echo $output; ?> - \ No newline at end of file + -- 2.17.1