/home
/deploy
/EHungry-3-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-3-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
"order_type_priority_92994_12060_1"
86400
"a:1:{i:0;O:17:"OrderTypePriority":27:{s:12:"pdfPageCount";i:0;s:10:"timestamps";b:0;s:9:"\x00*\x00hidden";a:1:{i:0;s:8:"password";}s:12:"\x00*\x00nullables";a:0:{}s:13:"\x00*\x00connection";N;s:8:"\x00*\x00table";N;s:13:"\x00*\x00primaryKey";s:2:"id";s:10:"\x00*\x00keyType";s:3:"int";s:12:"incrementing";b:1;s:7:"\x00*\x00with";a:0:{}s:12:"\x00*\x00withCount";a:0:{}s:10:"\x00*\x00perPage";i:15;s:6:"exists";b:0;s:18:"wasRecentlyCreated";b:0;s:13:"\x00*\x00attributes";a:4:{s:2:"id";i:-1;s:10:"order_type";s:6:"PICKUP";s:8:"priority";i:1;s:10:"account_id";i:92994;}s:11:"\x00*\x00original";a:1:{s:2:"id";i:-1;}s:8:"\x00*\x00casts";a:0:{}s:8:"\x00*\x00dates";a:0:{}s:13:"\x00*\x00dateFormat";N;s:10:"\x00*\x00appends";a:0:{}s:9:"\x00*\x00events";a:0:{}s:14:"\x00*\x00observables";a:0:{}s:12:"\x00*\x00relations";a:0:{}s:10:"\x00*\x00touches";a:0:{}s:10:"\x00*\x00visible";a:0:{}s:11:"\x00*\x00fillable";a:0:{}s:10:"\x00*\x00guarded";a:1:{i:0;s:1:"*";}}}"
/home
/deploy
/EHungry-3-boyan
/Web
/classes
/Cache.class.php
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;
}
public static function Exists(...$key):?bool {
if ($i = static::getInstance()) {
return $i->exists($key);
Arguments
"order_type_priority_92994_12060_1"
"a:1:{i:0;O:17:"OrderTypePriority":27:{s:12:"pdfPageCount";i:0;s:10:"timestamps";b:0;s:9:"\x00*\x00hidden";a:1:{i:0;s:8:"password";}s:12:"\x00*\x00nullables";a:0:{}s:13:"\x00*\x00connection";N;s:8:"\x00*\x00table";N;s:13:"\x00*\x00primaryKey";s:2:"id";s:10:"\x00*\x00keyType";s:3:"int";s:12:"incrementing";b:1;s:7:"\x00*\x00with";a:0:{}s:12:"\x00*\x00withCount";a:0:{}s:10:"\x00*\x00perPage";i:15;s:6:"exists";b:0;s:18:"wasRecentlyCreated";b:0;s:13:"\x00*\x00attributes";a:4:{s:2:"id";i:-1;s:10:"order_type";s:6:"PICKUP";s:8:"priority";i:1;s:10:"account_id";i:92994;}s:11:"\x00*\x00original";a:1:{s:2:"id";i:-1;}s:8:"\x00*\x00casts";a:0:{}s:8:"\x00*\x00dates";a:0:{}s:13:"\x00*\x00dateFormat";N;s:10:"\x00*\x00appends";a:0:{}s:9:"\x00*\x00events";a:0:{}s:14:"\x00*\x00observables";a:0:{}s:12:"\x00*\x00relations";a:0:{}s:10:"\x00*\x00touches";a:0:{}s:10:"\x00*\x00visible";a:0:{}s:11:"\x00*\x00fillable";a:0:{}s:10:"\x00*\x00guarded";a:1:{i:0;s:1:"*";}}}"
86400
/home
/deploy
/EHungry-3-boyan
/Web
/classes
/OrderTypePriority.class.php
//exclude unavailable order types
if ($availableOnly) {
$restaurant = new Restaurant($rid);
foreach ($rbs as $key => $orderTypesPriority) {
if (is_numeric($orderTypesPriority->getOrderType())) {
$type = new CustomOrderType($orderTypesPriority->getOrderType());
$activeRestaurants = json_decode($type->active_at_restaurants, true);
if (!$activeRestaurants[$restaurant->id]) {
unset($rbs[$key]);
}
} elseif (($orderTypesPriority->getOrderType() == 'PICKUP' && !$restaurant->has_pickup)
|| ($orderTypesPriority->getOrderType() == 'DINEIN' && !$restaurant->has_dine_in)
|| ($orderTypesPriority->getOrderType() == 'DELIVERY' && !$restaurant->has_delivery)) {
unset($rbs[$key]);
}
}
}
Cache::SetArray($cacheKey, $rbs);
return $rbs;
}
public static function clearCacheForRestaurant($aid, $rid) {
Cache::Delete('order_type_priority_'.$aid.'_'.$rid);
Cache::Delete('order_type_priority_'.$aid.'_'.$rid.'_1');
}
public function getDisplayName() {
if (is_numeric($this->getOrderType())) {
$customOrderType = new CustomOrderType($this->getOrderType());
if (is_object($customOrderType) && $customOrderType->getAccountId() == $this->getAccountId()) {
return $customOrderType->getDisplayName();
}
}
switch ($this->getOrderType()) {
case 'DELIVERY':
return 'Delivery';
case 'PICKUP':
return PICKUP_LABEL;
Arguments
"order_type_priority_92994_12060_1"
array:1 [
0 => OrderTypePriority {}
]
/home
/deploy
/EHungry-3-boyan
/Web
/classes
/Restaurant.class.php
}
/**
* @param bool $asCollection Returns an Illuminate collection instead of a plain array
* @return array|\Illuminate\Support\Collection All base order types which have enabled base/custom order types, with their labels.
*/
public function getEnabledBaseOrderTypes($asCollection = false) {
$result = collect(array_keys($this->getOrderTypesByBaseType()))
->mapWithKeys(function ($type) {
return [$type => getOrderTypeLabel($type)]; //TODO PHP 7.4 arrow func
});
return $asCollection? $result : $result->all();
}
/**
* @return array All order types, even custom ones, grouped by base order types.
* @see getOrderTypesByBaseType() if you need the labels as well
*/
public function getOrderTypesByBaseType() {
$orderTypePriorities = OrderTypePriority::getAllActiveForRestaurant($this->account_id, $this->id, true);
$orderTypesByBaseType = [];
foreach ($orderTypePriorities as $orderTypesPriority) {
if (is_numeric($orderTypesPriority->order_type)) {
$customOrderType = new CustomOrderType($orderTypesPriority->order_type);
$orderTypesByBaseType[$customOrderType->base_type][] = $customOrderType->display_name;
} else {
$orderTypesByBaseType[$orderTypesPriority->order_type][] = getOrderTypeLabel($orderTypesPriority->getOrderType());
}
}
return $orderTypesByBaseType;
}
/**
* @param bool $hasDelivery
* @param bool $hasPickup
* @param string $sortBy
* @param int $limit
* @param int $page
* @return Restaurant[]
*/
Arguments
/home
/deploy
/EHungry-3-boyan
/Web
/classes
/Restaurant.class.php
}
}
public function getProcessingFeeName() {
$additionalFeeName = "Processing Fee";
if ($this->getPerOrderSurchargeName()) {
$additionalFeeName = HS($this->getPerOrderSurchargeName());
if ($this->getPerOrderSurchargeType() == 2) {
$additionalFeeName .= " (".$this->getPerOrderSurcharge()."%)";
}
}
return $additionalFeeName;
}
/**
* @param bool $asCollection Returns an Illuminate collection instead of a plain array
* @return array|\Illuminate\Support\Collection All base order types which have enabled base/custom order types, with their labels.
*/
public function getEnabledBaseOrderTypes($asCollection = false) {
$result = collect(array_keys($this->getOrderTypesByBaseType()))
->mapWithKeys(function ($type) {
return [$type => getOrderTypeLabel($type)]; //TODO PHP 7.4 arrow func
});
return $asCollection? $result : $result->all();
}
/**
* @return array All order types, even custom ones, grouped by base order types.
* @see getOrderTypesByBaseType() if you need the labels as well
*/
public function getOrderTypesByBaseType() {
$orderTypePriorities = OrderTypePriority::getAllActiveForRestaurant($this->account_id, $this->id, true);
$orderTypesByBaseType = [];
foreach ($orderTypePriorities as $orderTypesPriority) {
if (is_numeric($orderTypesPriority->order_type)) {
$customOrderType = new CustomOrderType($orderTypesPriority->order_type);
$orderTypesByBaseType[$customOrderType->base_type][] = $customOrderType->display_name;
} else {
$orderTypesByBaseType[$orderTypesPriority->order_type][] = getOrderTypeLabel($orderTypesPriority->getOrderType());
}
/home
/deploy
/EHungry-3-boyan
/Web
/classes
/Restaurant.class.php
}
/**
* Returns the corrected Unix timestamp, or false if ordering is open.
* @return bool|int
*/
public function getLocalPublicOrderingClosedUntil() {
$closedUntil = $this->getPublicOrderingClosedUntil();
return $closedUntil? strtotime( //the timestamp we get below still obeys timezones, so we just strip it from the final result
convertFromServerTime($closedUntil->format('Y-m-d H:i:s'), $this->getTimeZoneId(), 'Y-m-d H:i:s')
) : false;
}
/**
* Finds the earliest time when an order type will reopen, but only if all enabled order types are currently closed.
* @return \Carbon\Carbon|null Null if any order type is open
*/
public function getPublicOrderingClosedUntil(): ?\Carbon\Carbon {
$closedUntilTime = strtotime('+100 years');
foreach (array_keys($this->getEnabledBaseOrderTypes()) as $orderType) {
$orderType = strtolower($orderType);
$closedUntil = $this->{$orderType.'_ordering_closed_until'}; /** @var ?\Carbon\Carbon $closedUntil */
if (!$closedUntil || $closedUntil->isPast()) {
return null;
}
if (strtotime($closedUntil) < $closedUntilTime) {
$closedUntilTime = strtotime($closedUntil);
}
}
return new \Carbon\Carbon(date("Y-m-d H:i:s", $closedUntilTime));
}
/**
* Gives you a whole sentence telling until when the place is closed, optionally for a specific order type, and optionally without the actual sentence. If they'll physically close before the temporary closure timestamp, will return that instead.
* @param bool $asTimestamp If true, returns a UNIX timestamp
* @param ?string $orderType PICKUP, DELIVERY, DINEIN, or null for all enabled order types
* @param bool $timeOnly If true, returns just the time portion (which could be "9:00PM", "tomorrow at 3:00AM", etc)
* @return int|string|null Null if the given order type is open, or if no order type is given and any of the enabled types is open.
* @see getPickupClosedUntilText()
* @see getDeliveryClosedUntilText()
/home
/deploy
/EHungry-3-boyan
/Web
/classes
/Restaurant.class.php
if (!$this->$closeField) {
return 0;
}
$openField = str_replace('closed', 'open', $closeField);
$endHour = $this->$closeField;
$nextDay = ($this->$closeField <= $this->$openField)? '+ 1 day' : '';
return strtotime("$date $endHour $nextDay");
}
/**
* Returns true if all order types are closed (or a specific $orderType). False otherwise
* @param string $orderType
* @return bool
*/
public function getPublicOrderingIsClosed($orderType = null): bool {
if ($orderType) {
return $this->{strtolower($orderType) . '_ordering_closed_until'} && $this->{strtolower($orderType) . '_ordering_closed_until'}->isFuture();
}
return $this->getPublicOrderingClosedUntil() && $this->getPublicOrderingClosedUntil()->isFuture(); //TODO: nullsafe operator
}
/**
* An easier way to say they had selected "close indefinitely" at some point.
* Or just a pretty way to encapsulate that ugly workaround with a date field ¯\_(ツ)_/¯
* @param string $orderType
* @return bool
*/
public function getPublicOrderingIsClosedForever($orderType = null): bool {
if ($orderType) {
return $this->{strtolower($orderType) . '_ordering_closed_until'} && $this->{strtolower($orderType) . '_ordering_closed_until'}->diffInYears(null, false) < -1;
}
return $this->getPublicOrderingClosedUntil() && $this->getPublicOrderingClosedUntil()->diffInYears(null, false) < -1;
}
public function getAnOrderTypeOrderingIsClosed(): bool {
return $this->getPublicOrderingIsClosed('pickup') || $this->getPublicOrderingIsClosed('dinein') || $this->getPublicOrderingIsClosed('delivery');
}
/**
/home
/deploy
/EHungry-3-boyan
/Web
/lib
/global.php
* You can also use the {@link CLOSED_MSG_RESTAURANT} flag, which will return a message
* telling the customer ordering is not currently available.
* @param bool $skipLoginCheck skips login check to determine whether or not ordering is disabled regardless of session.
* @return string|bool If a "close message" is set, will return it. Otherwise, returns the given parameter or true if
* none is found. Finally, false in case ordering is available.
*/
function isOrderingClosed($defaultMsg = null, $returnClosedUntilTime = false, $skipLoginCheck = false) {
global $restaurant, $global_reseller;
$notif_options = is_object($restaurant)? (int)$restaurant->order_sending_methods : 0; //forcing to int is enough to type-cast the second parameter
//main system status
$system = AccessStatus::getStatus();
if ($system->is_ordering_closed || $notif_options & $system->is_notif_closed) {
$result = $system->close_message;
} elseif (is_object($global_reseller) && (
$global_reseller->is_ordering_closed || $notif_options & $global_reseller->is_notif_closed
)) {
//reseller-forced closure
$result = $global_reseller->close_message;
} elseif (is_object($restaurant) && !isLoggedAsCustomerAdmin() && $restaurant->getPublicOrderingIsClosed()) {
//allows entry of account managers only, if the restaurant is closed
$result = true;
}
if (isset($result)) {
if (is_string($result) && strlen(trim($result))) {
return $returnClosedUntilTime ? 'Indefinitely' : $result;
}
if ($defaultMsg == CLOSED_MSG_RESTAURANT && is_object($restaurant)) {
if ($restaurant->getPublicOrderingIsClosedForever()) {
return $returnClosedUntilTime ? 'Indefinitely' : 'Online ordering is not currently offered at this location.';
}
if ($restaurant->public_ordering_closed_until) {
return $restaurant->getLocalPublicOrderingClosedUntilText($returnClosedUntilTime);
}
}
if (is_string($defaultMsg)) {
return $returnClosedUntilTime ? 'Indefinitely' : $defaultMsg;
}
/home
/deploy
/EHungry-3-boyan
/Web
/model3.0
/customer
/ordering3.php
}
$_REQUEST['_PAGETITLE_IS_ORDERING'] = true;
switch ($_REQUEST['ordering_level']) {
case 0:
$_REQUEST['_PAGETITLE'] = 'Choose A Location';
break;
case 1: //Restaurant
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)) {
Arguments
/home
/deploy
/EHungry-3-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-3-boyan/Web/model3.0/customer/ordering3.php"
/home
/deploy
/EHungry-3-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-3-boyan/Web/controllers/customer.php"