/home
/deploy
/EHungry-5-boyan
/Web
/classes
/Cache.class.php
}
public static function SetObject($key, $var, $expire = 86400) {
return static::Set($key, serialize($var), $expire);
}
public static function SetArray($key, $var, $expire = 86400) {
return static::Set($key, serialize($var), $expire);
}
public static function SetBoolean($key, $var, $expire = 86400) {
return static::Set($key, serialize($var), $expire);
}
public static function Set($key, $var, $expire = 86400) {
App::debugbarLog('debug', "Cache set: $key");
if ($i = static::getInstance()) {
$var = static::beforeSet($var);
return $expire > 0?
$i->setEx($key, $expire, $var) :
$i->set($key, $var);
}
return null;
}
public static function Exists(...$key):?bool {
if ($i = static::getInstance()) {
return $i->exists($key);
}
return null;
}
public static function Expire($key, $ttl) {
if ($i = static::getInstance()) {
return $i->expire($key, $ttl);
}
return false;
}
/**
Arguments
"MISCONF Redis is configured to save RDB snapshots, but it is currently not able to persist on disk. Commands that may modify the data set are disabled, because this instance is configured to report errors during writes if RDB snapshotting fails (stop-writes-on-bgsave-error option). Please check the Redis logs for details about the RDB error."
/home
/deploy
/EHungry-5-boyan
/Web
/classes
/Cache.class.php
}
public static function SetObject($key, $var, $expire = 86400) {
return static::Set($key, serialize($var), $expire);
}
public static function SetArray($key, $var, $expire = 86400) {
return static::Set($key, serialize($var), $expire);
}
public static function SetBoolean($key, $var, $expire = 86400) {
return static::Set($key, serialize($var), $expire);
}
public static function Set($key, $var, $expire = 86400) {
App::debugbarLog('debug', "Cache set: $key");
if ($i = static::getInstance()) {
$var = static::beforeSet($var);
return $expire > 0?
$i->setEx($key, $expire, $var) :
$i->set($key, $var);
}
return null;
}
public static function Exists(...$key):?bool {
if ($i = static::getInstance()) {
return $i->exists($key);
}
return null;
}
public static function Expire($key, $ttl) {
if ($i = static::getInstance()) {
return $i->expire($key, $ttl);
}
return false;
}
/**
Arguments
"menuitemimage_default_1005514"
86400
"N;"
/home
/deploy
/EHungry-5-boyan
/Web
/classes
/Cache.class.php
public static function getInstance() {
if (static::$redisObj === null) {
static::$redisObj = new Redis();
try {
if (!@static::$redisObj->connect(static::$host, (int)static::$port)) {
static::$redisObj = false;
Splunk::log(Splunk::LOG_REDIS_CONN, ['error' => 'Error connecting']);
} else {
static::$redisObj->select(static::$db);
}
} catch (RedisException $e) {
static::$redisObj = false;
Splunk::log(Splunk::LOG_REDIS_CONN, ['error' => 'Error connecting: '.$e->getMessage()]);
}
}
return static::$redisObj;
}
public static function SetObject($key, $var, $expire = 86400) {
return static::Set($key, serialize($var), $expire);
}
public static function SetArray($key, $var, $expire = 86400) {
return static::Set($key, serialize($var), $expire);
}
public static function SetBoolean($key, $var, $expire = 86400) {
return static::Set($key, serialize($var), $expire);
}
public static function Set($key, $var, $expire = 86400) {
App::debugbarLog('debug', "Cache set: $key");
if ($i = static::getInstance()) {
$var = static::beforeSet($var);
return $expire > 0?
$i->setEx($key, $expire, $var) :
$i->set($key, $var);
}
return null;
}
Arguments
"menuitemimage_default_1005514"
"N;"
86400
/home
/deploy
/EHungry-5-boyan
/Web
/classes
/MenuItemImage.class.php
* @param int $mid
* @return MenuItemImage|null
*/
public static function getDefaultByMenuItem($mid = -1) {
$cacheKey = self::cacheDefaultImgKey($mid);
if ($mid > 0) {
/** @var \MenuItemImage|null $cached */
$cached = Cache::GetObject($cacheKey, true);
if ($cached || is_null($cached)) {
return $cached;
}
/** @var \MenuItemImage|null $img */
if ($img = self::where(['is_default' => true, 'menu_item_id' => $mid])->first()) {
Cache::SetObject($cacheKey, $img);
return $img;
}
}
Cache::SetObject($cacheKey, null);
return null;
}
private static function cacheDefaultImgKey($menuItemId) {
return "menuitemimage_default_$menuItemId";
}
public static function cacheDeleteDefaultImg($menuItemId) {
Cache::Delete(self::cacheDefaultImgKey($menuItemId));
}
/**
* The complete URL to display the image, including the timestamp for cache busting
* @param bool $withTimestamp Will skip the timestamp if false is given here
* @param int $thumbSize If given, retrieves the thumbnail URL instead, if one exists
* @return string
*/
public function getUrl($withTimestamp = true, int $thumbSize = null) {
$withTimestamp = is_null($withTimestamp)? true : $withTimestamp;
return ($this->is_url? $this->img_name : $this->getBaseUrl(null, $thumbSize, $withTimestamp));
Arguments
"menuitemimage_default_1005514"
null
/home
/deploy
/EHungry-5-boyan
/Web
/classes
/MenuItem.class.php
public function getSelectedPrice() {
return $this->selectedPrice;
}
public function setSelectedPrice(MenuItemPrice $price = null) {
$this->selectedPrice = $price;
}
public function getUniqueId() {
return $this->uuid;
}
public function setUniqueId($uuid = null) {
$this->uuid = $uuid;
}
/**
* @return MenuItemImage|null
*/
public function getDefaultImage() {
if (!$this->defaultImage) {
$this->setDefaultImage(MenuItemImage::getDefaultByMenuItem($this->getId()));
}
return $this->defaultImage;
}
public function setDefaultImage(MenuItemImage $image = null) {
$this->defaultImage = $image;
}
/**
* @param $account
* @return MenuItemImage|string|null
*/
public function getThumbUrl($account) {
$default_image = $this->getDefaultImage();
if (!$default_image
&& $account instanceof Account
&& ($account->getDefaultMenuItemImage() || $account->hasImages(Account::IMAGE_FIELD_DEFAULT_MENU_ITEM_IMAGE))) {
return $account->getUrl(Account::IMAGE_FIELD_DEFAULT_MENU_ITEM_IMAGE);
}
Arguments
/home
/deploy
/EHungry-5-boyan
/Web
/classes
/MenuItem.class.php
$str .= "<img src='".$mii->getUrl()."' alt='".$mii->name."' style='vertical-align:middle' class='menuItemImage " .$mii->getClass(). "' />";
} else {
$str .= "<img src='/web/images/".$mii->file.".png' alt='".$mii->name."' style='vertical-align:middle;' class='menuItemImage bigger' />";
}
}
$str .= '</h3>';
return $str;
}
/*
*
* @return string The HTML to render on the page for the category page
*/
public function formatCategoryHtml($account, $restaurant, $menu, $category, $hidePrices) {
$str = '';
if (count($this->getPrices())) {
$priceFormat = array_key_exists('item_price_format', $_REQUEST['_TEMPLATE_SETTINGS'])?$_REQUEST['_TEMPLATE_SETTINGS']['item_price_format']->value:'individual';
$prices = $this->getPrices();
$default_image = $this->getDefaultImage();
if (!$default_image && is_object($account) && $account->getDefaultMenuItemImage()) {
$default_image = $account->getUrl('defaultMenuItemImage');
} elseif ($default_image instanceof MenuItemImage) {
$default_image = $default_image->getUrl(true, 110);
}
$str .= '<li class="item '.($default_image?'':'fullrow').' menuItem_'.$this->getId().' ' . ($this->is_unavailable?'itemSoldOut':'') . '"><a href="'.formatCustomerOrderLink([$restaurant, $menu, $category, $this]).'">';
$pricesStyle = !$this->getIsOrderable() && $this->getHasNoPrices() ? 'display:none;' : '';
$str .= '<div class="itemContent">';
if ($priceFormat == 'range') {
$str .= '<header>'.$this->makeItemTitle().'<p class="description">'.$this->getDescriptionWithoutAnchors().'</p></header><div class="prices" style="'.$pricesStyle.'">';
$str .= count($prices) > 1 ? '$'.(number_format($prices[0]['price_value']/100, 2)).' - '.'$'.(number_format($prices[count($prices)-1]['price_value']/100, 2)) : '$'.(number_format($prices[0]['price_value']/100, 2));
$str .= '</div>';
} else {
if (count($prices) == 1 && $prices[0]->getDisplayName() == $this->getDisplayName()) {
$str .= "<table class='variations' role='presentation'>
<tr>
<td class='description'>".$this->makeItemTitle()."</td>
<td colspan='2'></td>
</tr>
/home
/deploy
/EHungry-5-boyan
/Web
/classes
/Category.class.php
$str .= '<section class="menucategory"><h2 class="menucategoryHeading">'.$cat->getDisplayName().'</h2>';
}
if ($cat->getDescription() != '') {
$str .= '<section class="categoryDescription mb10 mt10">'.$cat->getDescription().'</section>';
}
if ($its) {
$str .= '<ul class="menuitems" style="margin-top: 20px;">';
foreach ($its as $i) {
$str .= $i->formatCategoryHtml($account, $restaurant, $menu, $cat, $hidePrices);
}
$str .= '</ul>';
} else {
$str .= '<div class="error">There are currently no menu items available in this category.</div>';
}
$str .= '</section>';
}
} elseif ($items) { //category view
$str .= '<ul class="menuitems" style="margin-top: 20px;">';
foreach ($items as $i) {
$str .= $i->formatCategoryHtml($account, $restaurant, $menu, $category, $hidePrices);
}
$str .= '</ul>';
} else {
$str .= '<div class="error">There are currently no menu items available in this category. Please select another category or <a href="'.formatCustomerOrderLink([$restaurant, $menu, -1]).'">view all</a> items available on the '.$menu->getDisplayName().' menu.</div>';
}
$str .= '</section>';
return $str;
}
public function setPriorityForAllSiblings() {
$db_conn = DB::conn();
$sql = "UPDATE ".Category::getTableName()." SET priority = ? WHERE parent_id = ?";
$db_conn->bindParameter($sql, 1, $this->getPriority(), "integer");
$db_conn->bindParameter($sql, 1, $this->getId(), "integer");
return $db_conn->query($sql);
}
public function getAllSiblings() {
$db_conn = DB::conn();
$arr = [];
Arguments
Account {}
Restaurant {}
Menu {}
Category {}
0
/home
/deploy
/EHungry-5-boyan
/Web
/classes
/Account.class.php
($_SESSION['embed']? '_embed' : '').
AWS_S3_REGION;
// try to retrieve from the cache server
$page_fragment = Cache::Get($cache_key);
if (!$page_fragment) {
//echo 'Building Category Page Fragment<br />';
if ($cid === -1) {
$category = new Category(-1);
$category->setDisplayName('View All Menu Items');
$category->setMenuId($menu->getId());
} else {
$category = new Category($cid);
}
$items = $this->getCategoryItems($category, $menu, $is_admin, $restaurant, $sortByCategory);
// now build the page fragment
$page_fragment = Category::buildPageFragment($menu, $category, $items, $hidePrices, $sortByCategory, $is_admin);
Cache::Set($cache_key, $page_fragment);
} else {
//echo 'Using cached Category Page Fragement<br />';
}
return $page_fragment;
}
public function getCategoryItems($category, $menu = null, $is_admin = false, $restaurant = null, $sortByCategory = false) {
$cache_key =
($is_admin? 'admin_category_items' : 'category_4.0_items').
"_{$this->getId()}_{$menu->getId()}_{$category->getId()}_".
($sortByCategory? 'cat_' : 'alp_').
$restaurant->getId().
($_SESSION['embed']? '_embed' : '');
$items = Cache::GetArray($cache_key);
if (!$items) {
$items = [];
if ($category->getId() > 0) {
$items = $category->getItems($menu->id, false, false, false, false, false, $is_admin, $this->display_zero_dollar_items);
} elseif (is_object($restaurant)) {
Arguments
Menu {}
Category {}
array:13 [
0 => MenuItem {}
1 => MenuItem {}
2 => MenuItem {}
3 => MenuItem {}
4 => MenuItem {}
5 => MenuItem {}
6 => MenuItem {}
7 => MenuItem {}
8 => MenuItem {}
9 => MenuItem {}
10 => MenuItem {}
11 => MenuItem {}
12 => MenuItem {}
]
0
true
false
/home
/deploy
/EHungry-5-boyan
/Web
/model3.0
/customer
/ordering3.php
if (count($menus) == 1) {
$qs = '';
if ($_GET['embed']) {
$qs = '?embed='.$_GET['embed'];
}
redirectToOrdering([$restaurant, reset($menus)], $qs);
}
$_REQUEST['_PAGETITLE'] = 'Choose A Menu';
break;
case 2: //Menu
break;
case 3: //Category
if (isOrderingClosed(CLOSED_MSG_RESTAURANT)) {
$contentAndCartClass = 'contentandcart-category-closed';
}
if (ClosedHours::isCategoryHidden($restaurant, $category) || HolidayHours::isCategoryHidden($restaurant, $category)) {
redirectToOrderingWithError('Sorry, this category is currently unavailable.', [$restaurant, $menu, -1]);
}
$page_fragment = $account->getCategoryPageFragment($menu, $category->getId(), $restaurant->getHideAllPrices(), $restaurant, true);
if (isset($_REQUEST['sort'])) {
if ($_REQUEST['sort'] == "name") {
usort($items, array("MenuItem", "nameAlphaSort"));
} elseif ($_REQUEST['sort'] == "price") {
usort($items, array("MenuItem", "priceSort"));
}
}
break;
case 4: //Item
case 5: //Price
//check if we're closed right now. If so, display warning
if (!isset($_SESSION['time_ok']) && is_object($restaurant)) {
$eot = checkTimeWarning($cart, $restaurant);
}
break;
}
if ($_REQUEST['ordering_level'] < 3 && is_object($menu)) {
if ($account->getDefaultOrderingPage() == 1) {
Arguments
Menu {}
109267
0
Restaurant {}
true
/home
/deploy
/EHungry-5-boyan
/Web
/controllers
/customer.php
$cart->setDefaultOrderType($account, $restaurant);
$cart->setDefaultFees($account, $restaurant);
}
$restaurantRequiredPages = [
'login',
'customerorders'
];
if (is_null($restaurant) && in_array($_REQUEST['form'], $restaurantRequiredPages)) {
redirectTo('home');
}
$modelPath = CORE_PATH . 'model4.0/customer/'.$_REQUEST['form'].'.php';
} else {
$_REQUEST['mobiledetect'] = new Mobile_Detect;
}
if (is_readable($modelPath)) {
include_once($modelPath);
}
App::debugbarTime("model '{$_REQUEST['form']}'");
$custom_nav = CustomNavigationTab::getAllForAccount($account->getId());
$view2HideRightColumns = ['checkout', 'dashboard', 'customerdetails', 'customerorders',
'mydeliveryaddresses', 'emailpreferences', 'mycoupons', 'mycreditcards', 'mypassword',
'customerorderdetails', 'editcustomer', 'adddeliveryaddress',
'editlocation', 'orderconfirmation','viewcart', 'map', 'validatecallback'];
if (in_array($_REQUEST['form'], $view2HideRightColumns)) {
$hideRightColumn = true;
}
$myAccountPages = ['accountsettings', 'dashboard', 'customerdetails', 'customerorders', 'editaddress', 'editcustomer', 'mydeliveryaddresses', 'editlocation', 'emailpreferences', 'mycoupons', 'mycreditcards', 'mypassword', 'adddeliveryaddress', 'map', 'myloyalty'];
if (in_array($_REQUEST['form'], $myAccountPages)) {
$isMyAccountPage = true;
}
if (!isset($cart) || !is_object($cart)) {
$GLOBALS['cart'] = \Cart::getCurrent();
Arguments
"/home/deploy/EHungry-5-boyan/Web/model3.0/customer/ordering3.php"
/home
/deploy
/EHungry-5-boyan
/Web
/index.php
App::startTime();
ErrorHandlers::register();
// Global.php is the core setup file for the application
App::debugbarTime('Global.php');
require(dirname(__DIR__) . '/PHP/Global.php');
App::debugbarTime('Global.php');
/** @var string $controller The main controller - defined at /PHP/Global.php */
App::debugbarTime('Sentry - controller');
ErrorHandlers::sentryInit($controller); //doesn't always do much - not every controller has a Sentry project
App::debugbarTime('Sentry - controller');
App::debugbarTime("controller: $controller");
apache_note('AppController', $controller);
if (file_exists(CORE_PATH."lib/helpers/$controller.php")) {
require CORE_PATH."lib/helpers/$controller.php";
}
require CORE_PATH."controllers/$controller.php";
App::debugbarTime("controller: $controller");
Arguments
"/home/deploy/EHungry-5-boyan/Web/controllers/customer.php"