/home
/deploy
/EHungry-2-boyan
/Web
/classes
/Cache.class.php
if ($r) {
$uco = unserialize($r);
$typeFunc = 'is_'.$type;
if ($typeFunc($uco) || ($allowNull && is_null($uco))) {
return $uco;
}
}
return $notFoundResult;
}
public static function Get($key) {
if (array_key_exists($key, static::$requestCache)) {
$r = static::$requestCache[$key];
$r = static::afterGet($r);
App::cacheHit($key);
return $r;
}
if ($i = static::getInstance()) {
if ($r = $i->get($key)) {
//if a key has been used more than 3 times, store it in the in-memory request cache.
//We don't store every cache load in-memory, otherwise we might run out of memory on some pages (eg if they load every account)
if (!array_key_exists($key, static::$requestCount)) {
static::$requestCount[$key] = 0;
}
static::$requestCount[$key]++;
if (static::$requestCount[$key] > 3) {
static::$requestCache[$key] = $r;
}
$r = static::afterGet($r);
App::cacheHit($key);
} else {
App::cacheMiss($key);
}
return $r;
}
return false;
}
/**
Arguments
"read error on connection"
/home
/deploy
/EHungry-2-boyan
/Web
/classes
/Cache.class.php
if ($r) {
$uco = unserialize($r);
$typeFunc = 'is_'.$type;
if ($typeFunc($uco) || ($allowNull && is_null($uco))) {
return $uco;
}
}
return $notFoundResult;
}
public static function Get($key) {
if (array_key_exists($key, static::$requestCache)) {
$r = static::$requestCache[$key];
$r = static::afterGet($r);
App::cacheHit($key);
return $r;
}
if ($i = static::getInstance()) {
if ($r = $i->get($key)) {
//if a key has been used more than 3 times, store it in the in-memory request cache.
//We don't store every cache load in-memory, otherwise we might run out of memory on some pages (eg if they load every account)
if (!array_key_exists($key, static::$requestCount)) {
static::$requestCount[$key] = 0;
}
static::$requestCount[$key]++;
if (static::$requestCount[$key] > 3) {
static::$requestCache[$key] = $r;
}
$r = static::afterGet($r);
App::cacheHit($key);
} else {
App::cacheMiss($key);
}
return $r;
}
return false;
}
/**
Arguments
/home
/deploy
/EHungry-2-boyan
/Web
/classes
/Cache.class.php
* @param string $key
* @param bool $allowNull
* @return bool|array|null
*/
public static function GetArray($key, $allowNull = false) {
return static::GetType('array', $key, $allowNull);
}
/**
* This one can either return a boolean when key is found, or a null if key isn't found. So you need to check the
* result with with is_bool() or is_null().
* @param string $key The key to lookup
* @return bool|null
*/
public static function GetBoolean($key) {
return static::GetType('bool', $key, false, null);
}
private static function GetType($type, $key, $allowNull, $notFoundResult = false) {
$r = static::Get($key);
if ($r) {
$uco = unserialize($r);
$typeFunc = 'is_'.$type;
if ($typeFunc($uco) || ($allowNull && is_null($uco))) {
return $uco;
}
}
return $notFoundResult;
}
public static function Get($key) {
if (array_key_exists($key, static::$requestCache)) {
$r = static::$requestCache[$key];
$r = static::afterGet($r);
App::cacheHit($key);
return $r;
}
if ($i = static::getInstance()) {
if ($r = $i->get($key)) {
Arguments
/home
/deploy
/EHungry-2-boyan
/Web
/classes
/Cache.class.php
}
/**
* Returns object if found in cache, otherwise false. Can also return null if found in cache and null allowed
* @param string $key
* @param bool $allowNull
* @return bool|object|null
*/
public static function GetObject($key, $allowNull = false) {
return static::GetType('object', $key, $allowNull);
}
/**
* Returns array if found in cache, otherwise false. Can also return null if found in cache and null allowed
* @param string $key
* @param bool $allowNull
* @return bool|array|null
*/
public static function GetArray($key, $allowNull = false) {
return static::GetType('array', $key, $allowNull);
}
/**
* This one can either return a boolean when key is found, or a null if key isn't found. So you need to check the
* result with with is_bool() or is_null().
* @param string $key The key to lookup
* @return bool|null
*/
public static function GetBoolean($key) {
return static::GetType('bool', $key, false, null);
}
private static function GetType($type, $key, $allowNull, $notFoundResult = false) {
$r = static::Get($key);
if ($r) {
$uco = unserialize($r);
$typeFunc = 'is_'.$type;
if ($typeFunc($uco) || ($allowNull && is_null($uco))) {
return $uco;
}
Arguments
"array"
"rmenus_7654_0"
false
/home
/deploy
/EHungry-2-boyan
/Web
/classes
/Restaurant.class.php
}
}
public function sortMenus($a, $b) {
if ($a->getPriority() == $b->getPriority()) {
return 0;
} elseif ($a->getPriority() > $b->getPriority()) {
return 1;
} else {
return -1;
}
}
/**
* @param false $withHidden
* @return Menu[]
*/
public function getAllMenus($withHidden = false) {
$cacheKey = 'rmenus_'.$this->getId().'_'.($withHidden? '1' : '0');
$co = Cache::GetArray($cacheKey);
if (!$co) {
$db_conn = DB::conn();
$co = [];
$sql = "SELECT menu_id FROM ".MenuRestaurant::getTableName()." WHERE restaurant_id = ?";
$db_conn->bindParameter($sql, 1, $this->getId(), "integer");
$result = $db_conn->query($sql);
if ($result && $result->rowCount() > 0) {
while ($row = $result->fetch()) {
$m = new Menu($row["menu_id"]);
if ($withHidden || !$m->getIsHidden()) {
$co[] = $m;
}
}
}
usort($co, ["Restaurant", "sortMenus"]);
Cache::SetArray($cacheKey, $co);
}
if (!empty($_REQUEST['hidden_menu']) && is_object($_REQUEST['hidden_menu'])) {
$found = false;
foreach ($co as $m) {
Arguments
/home
/deploy
/EHungry-2-boyan
/Web
/classes
/Restaurant.class.php
if ($m->id == $_REQUEST['hidden_menu']->id) {
$found = true;
break;
}
}
if (!$found) {
$co[] = $_REQUEST['hidden_menu'];
usort($co, ["Restaurant", "sortMenus"]);
}
}
return $co;
}
/**
* Gets menus that are currently active (does not check day-of-the-week or time of day availability)
* @return Menu[]
*/
public function getActiveMenus($withHidden = false): array {
return array_values(array_filter(
$this->getAllMenus($withHidden),
function ($menu) {
return $this->isMenuActive($menu);
}
));
}
public function isMenuActive(Menu $menu): bool {
return $menu->isCurrentlyActive($this);
}
public function getDefaultMenu(): ?Menu {
$menus = $this->getAllMenus();
$menu = null;
if ($this->getSelectMenuFromCurrentTime()) {
$menu = $this->getMenuByCurrentTime($menus);
}
// try to return a menu that is active and not hidden
for ($i = 0, $count = count($menus); $i < $count && is_null($menu); $i++) {
Arguments
/home
/deploy
/EHungry-2-boyan
/Web
/model3.0
/customer
/ordering3.php
$unavail = [];
$unavailable_menu_ids = [];
foreach ($unavailableMenuItemsInfo as $info) {
if ($info['category_id'] == $category->id || $category->id == -1) {
$unavail[] = 'div.menuItem_'.$info['menu_item_id'];
$unavail[] = 'li.menuItem_'.$info['menu_item_id'];
$unavailable_menu_ids[] = $info['menu_item_id'];
}
}
if (count($unavail) > 0) {
$unavail = '<style type="text/css">'.join(', ', $unavail).' {display:none !important;}</style>';
} else {
unset($unavail);
}
// Page description and title
$pageDescription = 'Order '.mb_strtolower($category->getDisplayName()).' online from '.$account->getDisplayName().' '.($orderTypeText?'for '.$orderTypeText:'').'. The best '.$restaurant->getCuisineType().' in '.$restaurant->getCity().', '.$restaurant->getState().'.';
$_REQUEST['_PAGETITLE'] = $category->getDisplayName();
$menus = $restaurant->getActiveMenus();
if (count($menus) > 1) {
$_REQUEST['_PAGETITLE'] .= ' | ' . $menu->getDisplayName();
}
$restaurants = $account->getActiveRestaurants();
if (count($restaurants) > 1 && $restaurant->getDisplayName() != $account->getDisplayName()) {
$_REQUEST['_PAGETITLE'] .= ' | ' . $restaurant->getDisplayName();
}
$_REQUEST['_PAGETITLE_FULL'] = true;
// We check whether the SEO description is enabled to determine whether to show the SEO message or not
if ($account->getSeoDescriptionDisabled()) {
// SEO description is disabled
$_REQUEST['_PAGEH2'] = "";
} else {
// SEO description is enabled
$_REQUEST['_PAGEH2'] = $pageDescription;
}
$_REQUEST['_PAGEDESCRIPTION'] = $pageDescription;
/home
/deploy
/EHungry-2-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-2-boyan/Web/model3.0/customer/ordering3.php"
/home
/deploy
/EHungry-2-boyan
/Web
/index.php
echo 'OK';
exit;
}
// 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-2-boyan/Web/controllers/customer.php"