/home
/deploy
/EHungry-11-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-11-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
"ch_r10077_tuesday_DELIVERY_0"
86400
"a:2:{i:0;O:11:"ClosedHours":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:1;s:18:"wasRecentlyCreated";b:0;s:13:"\x00*\x00attributes";a:19:{s:2:"id";i:28306;s:10:"account_id";i:81353;s:13:"restaurant_id";i:10077;s:10:"start_time";s:8:"06:01:00";s:8:"end_time";s:8:"23:59:00";s:6:"monday";i:0;s:7:"tuesday";i:1;s:9:"wednesday";i:0;s:8:"thursday";i:0;s:6:"friday";i:0;s:8:"saturday";i:0;s:6:"sunday";i:0;s:7:"message";s:0:"";s:6:"pickup";i:1;s:8:"delivery";i:1;s:6:"dinein";i:1;s:17:"ordering_disabled";i:1;s:11:"category_id";N;s:25:"show_category_when_closed";i:0;}s:11:"\x00*\x00original";a:19:{s:2:"id";i:28306;s:10:"account_id";i:81353;s:13:"restaurant_id";i:10077;s:10:"start_time";s:8:"06:01:00";s:8:"end_time";s:8:"23:59:00";s:6:"monday";i:0;s:7:"tuesday";i:1;s:9:"wednesday";i:0;s:8:"thursday";i:0;s:6:"friday";i:0;s:8:"saturday";i:0;s:6:"sunday";i:0;s:7:"message";s:0:"";s:6:"pickup";i:1;s:8:"delivery";i:1;s:6:"dinein";i:1;s:17:"ordering_disabled";i:1;s:11:"category_id";N;s:25:"show_category_when_closed";i:0;}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:"*";}}i:1;O:11:"ClosedHours":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:1;s:18:"wasRecentlyCreated";b:0;s:13:"\x00*\x00attributes";a:19:{s:2:"id";i:21791;s:10:"account_id";i:81353;s:13:"restaurant_id";i:10077;s:10:"start_time";s:8:"00:00:00";s:8:"end_time";s:8:"06:00:00";s:6:"monday";i:1;s:7:"tuesday";i:1;s:9:"wednesday";i:1;s:8:"thursday";i:1;s:6:"friday";i:1;s:8:"saturday";i:1;s:6:"sunday";i:1;s:7:"message";s:0:"";s:6:"pickup";i:1;s:8:"delivery";i:1;s:6:"dinein";i:1;s:17:"ordering_disabled";i:1;s:11:"category_id";N;s:25:"show_category_when_closed";i:0;}s:11:"\x00*\x00original";a:19:{s:2:"id";i:21791;s:10:"account_id";i:81353;s:13:"restaurant_id";i:10077;s:10:"start_time";s:8:"00:00:00";s:8:"end_time";s:8:"06:00:00";s:6:"monday";i:1;s:7:"tuesday";i:1;s:9:"wednesday";i:1;s:8:"thursday";i:1;s:6:"friday";i:1;s:8:"saturday";i:1;s:6:"sunday";i:1;s:7:"message";s:0:"";s:6:"pickup";i:1;s:8:"delivery";i:1;s:6:"dinein";i:1;s:17:"ordering_disabled";i:1;s:11:"category_id";N;s:25:"show_category_when_closed";i:0;}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-11-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
"ch_r10077_tuesday_DELIVERY_0"
"a:2:{i:0;O:11:"ClosedHours":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:1;s:18:"wasRecentlyCreated";b:0;s:13:"\x00*\x00attributes";a:19:{s:2:"id";i:28306;s:10:"account_id";i:81353;s:13:"restaurant_id";i:10077;s:10:"start_time";s:8:"06:01:00";s:8:"end_time";s:8:"23:59:00";s:6:"monday";i:0;s:7:"tuesday";i:1;s:9:"wednesday";i:0;s:8:"thursday";i:0;s:6:"friday";i:0;s:8:"saturday";i:0;s:6:"sunday";i:0;s:7:"message";s:0:"";s:6:"pickup";i:1;s:8:"delivery";i:1;s:6:"dinein";i:1;s:17:"ordering_disabled";i:1;s:11:"category_id";N;s:25:"show_category_when_closed";i:0;}s:11:"\x00*\x00original";a:19:{s:2:"id";i:28306;s:10:"account_id";i:81353;s:13:"restaurant_id";i:10077;s:10:"start_time";s:8:"06:01:00";s:8:"end_time";s:8:"23:59:00";s:6:"monday";i:0;s:7:"tuesday";i:1;s:9:"wednesday";i:0;s:8:"thursday";i:0;s:6:"friday";i:0;s:8:"saturday";i:0;s:6:"sunday";i:0;s:7:"message";s:0:"";s:6:"pickup";i:1;s:8:"delivery";i:1;s:6:"dinein";i:1;s:17:"ordering_disabled";i:1;s:11:"category_id";N;s:25:"show_category_when_closed";i:0;}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:"*";}}i:1;O:11:"ClosedHours":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:1;s:18:"wasRecentlyCreated";b:0;s:13:"\x00*\x00attributes";a:19:{s:2:"id";i:21791;s:10:"account_id";i:81353;s:13:"restaurant_id";i:10077;s:10:"start_time";s:8:"00:00:00";s:8:"end_time";s:8:"06:00:00";s:6:"monday";i:1;s:7:"tuesday";i:1;s:9:"wednesday";i:1;s:8:"thursday";i:1;s:6:"friday";i:1;s:8:"saturday";i:1;s:6:"sunday";i:1;s:7:"message";s:0:"";s:6:"pickup";i:1;s:8:"delivery";i:1;s:6:"dinein";i:1;s:17:"ordering_disabled";i:1;s:11:"category_id";N;s:25:"show_category_when_closed";i:0;}s:11:"\x00*\x00original";a:19:{s:2:"id";i:21791;s:10:"account_id";i:81353;s:13:"restaurant_id";i:10077;s:10:"start_time";s:8:"00:00:00";s:8:"end_time";s:8:"06:00:00";s:6:"monday";i:1;s:7:"tuesday";i:1;s:9:"wednesday";i:1;s:8:"thursday";i:1;s:6:"friday";i:1;s:8:"saturday";i:1;s:6:"sunday";i:1;s:7:"message";s:0:"";s:6:"pickup";i:1;s:8:"delivery";i:1;s:6:"dinein";i:1;s:17:"ordering_disabled";i:1;s:11:"category_id";N;s:25:"show_category_when_closed";i:0;}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-11-boyan
/Web
/classes
/ClosedHours.class.php
if ($aObj || is_null($aObj)) {
return $aObj;
}
$db_conn = DB::conn();
$rbs = array();
if ($cid && $isHiddenToCustomers) {
$sql .= ' AND show_category_when_closed = 0';
}
$sql = "SELECT * FROM ".ClosedHours::getTableName()." WHERE (restaurant_id = ? OR category_id = ?) ".$sql." ORDER BY id DESC";
$db_conn->bindParameter($sql, 1, $rid, "integer");
$db_conn->bindParameter($sql, 1, $cid, "integer");
$result = $db_conn->query($sql);
if ($result && $result->rowCount() > 0) {
while ($row = $result->fetch()) {
$ch = new ClosedHours();
$ch->loadFromArray($row, true);
$rbs[] = $ch;
}
Cache::SetArray($cacheKey, $rbs);
return $rbs;
}
Cache::SetObject($cacheKey, null);
return null;
}
public static function clearCache($rid, $cid = null) {
global $days;
$types = ['PICKUP', 'DINEIN', 'DELIVERY'];
$isHiddenToCustomersArray = [0, 1];
foreach ($days as $d) {
foreach ($types as $t) {
foreach ($isHiddenToCustomersArray as $isHiddenToCustomers) {
Cache::Delete('ch_'.($cid > 0? ('c'.$cid) : ('r'.$rid)).'_'.mb_strtolower($d).'_'.$t.'_'.$isHiddenToCustomers);
}
}
}
}
public function toString() {
Arguments
"ch_r10077_tuesday_DELIVERY_0"
array:2 [
0 => ClosedHours {}
1 => ClosedHours {}
]
/home
/deploy
/EHungry-11-boyan
/Web
/classes
/ClosedHours.class.php
}
if (!$time) {
$time = $restaurant->getLocalTime();
}
$closedHours = ClosedHours::getByDateAndCategoryAndType($time, $category->getId(), $orderType, $isHiddenToCustomers);
if (is_array($closedHours) && count($closedHours) > 0) {
return $closedHours;
}
//check parent category too
if ($category->getParentId()) {
$closedHours = ClosedHours::getByDateAndCategoryAndType($time, $category->getParentId(), $orderType, $isHiddenToCustomers);
if (is_array($closedHours) && count($closedHours) > 0) {
return $closedHours;
}
}
return false;
}
public static function getByDateAndRestaurantAndType($time = null, $rid = -1, $type = 'PICKUP') {
return ClosedHours::getByDateAndTypeAndRestaurantOrCategory($time, $rid, null, $type);
}
public static function getByDateAndCategoryAndType($time = null, $cid = null, $type = 'PICKUP', $isHiddenToCustomers = false) {
return ClosedHours::getByDateAndTypeAndRestaurantOrCategory($time, -1, $cid, $type, $isHiddenToCustomers);
}
public static function getByDateAndTypeAndRestaurantOrCategory($time = null, $rid = -1, $cid = -1, $type = 'PICKUP', $isHiddenToCustomers = false) {
$day = mb_strtolower(date('l', $time));
$sql = " AND ".$day." = 1";
if (!$type) {
$type = 'PICKUP';
}
switch ($type) {
case 'PICKUP':
$sql .= " AND pickup=1 ";
break;
case 'DELIVERY':
$sql .= " AND delivery=1 ";
break;
Arguments
1773128760
10077
null
"DELIVERY"
/home
/deploy
/EHungry-11-boyan
/Web
/classes
/Restaurant.class.php
// check to see if we are operating in holiday hours
$holidayHours = HolidayHours::getByDateAndRestaurantAndType(date('Y-m-d 00:00:00', $local), $this->getId(), $type);
if (is_object($holidayHours)) {
$startTime = strtotime(date('1990-01-01 H:i:00', strtotime($holidayHours->getStartHour())));
$endTime = strtotime(date('1990-01-01 H:i:00', strtotime($holidayHours->getEndHour())));
$readyTime = strtotime(date('1990-01-01 H:i:s', $local));
if (!$holidayHours->getIsClosed() && ($startTime <= $readyTime && $endTime >= $readyTime)) {
return [
'open' => true,
'dayNumber' => $dayNumber,
];
} else {
return [
'open' => false,
'error' => 'We are closed at the selected time. '.$holidayHours->getMessage(),
'dayNumber' => $dayNumber,
];
}
}
$closedHours = ClosedHours::getByDateAndRestaurantAndType($local, $this->getId(), $type);
if (is_array($closedHours) && count($closedHours) > 0) {
foreach ($closedHours as $h) {
$startTime = strtotime(date('1990-01-01 H:i:00', strtotime($h->getStartTime())));
$endTime = strtotime(date('1990-01-01 H:i:00', strtotime($h->getEndTime())));
$readyTime = strtotime(date('1990-01-01 H:i:s', $local));
if ($startTime <= $readyTime && $endTime >= $readyTime) {
if ($h->getOrderingDisabled()) {
return [
'open' => false,
'error' => 'We are closed at the selected time. '.$h->getMessage(),
'closedHours' => $h,
'dayNumber' => $dayNumber,
];
} else {
return [
'open' => false,
'error' => 'We are closed at the selected time. '.$h->getMessage(),
'dayNumber' => $dayNumber,
];
}
Arguments
1773128760
10077
"DELIVERY"
/home
/deploy
/EHungry-11-boyan
/Web
/classes
/Cart.class.php
}
}
return $additionalTime * 60; // converted from minutes to seconds
}
/**
* Determines if the given restaurant location is closed at the given time
* @param Restaurant $restaurant
* @param string $selectedReadyTime The timestamp to check
* @param null $menu
* @param bool $returnClosedHours
* @return bool|ClosedHours
*/
public function getIsClosedAtTime($restaurant, $selectedReadyTime, $menu = null, $returnClosedHours = false, $ignoreMenuTime = false) {
$menus = [null];
if (!$ignoreMenuTime) {
$menus = $menu ? [$menu] : ($this->getMenus() ?: [null]);
}
foreach ($menus as $menu) {
$openInfo = $restaurant->isOpenAtForType($selectedReadyTime, $this->getBaseOrderType(), $menu);
if ($returnClosedHours && isset($openInfo['closedHours']) && is_object($openInfo['closedHours'])) {
return $openInfo['closedHours'];
} elseif (!$openInfo['open']) {
return true;
}
}
return false;
}
public function getIsTypeClosed($restaurant) {
return $this->getIsClosedAtTime($restaurant, $restaurant->getLocalTime());
}
/**
* Finds what day an order is actually for (when placed after midnight especially)
* @param Restaurant $restaurant
* @param string $selectedReadyTime The timestamp to check
* @return int|null
*/
public function getDayOrderIsFor($restaurant, $selectedReadyTime) {
Arguments
1773128760
"DELIVERY"
null
/home
/deploy
/EHungry-11-boyan
/Web
/classes
/Cart.class.php
* @return false|float|int
*/
public function getNextOpenTime($restaurant, $selectedTime, $ignoreMenuTime = false, $noLimit = false) {
if (!$ignoreMenuTime && isset($_SESSION['menu_id'])) {
$menu = new Menu($_SESSION['menu_id']);
} else {
$menu = null;
}
$selectedTime = floor($selectedTime / 60) * 60;
//if we're open at the selected time, just return that
if (!$this->getIsClosedAtTime($restaurant, $selectedTime, $menu, false, $ignoreMenuTime)) {
return $selectedTime;
}
$limit = $noLimit ? 8736 : 336; //336 = 14 * 24 = 2 weeks / 8736 = 1 year
$findOpenTime = function ($selectedTime, $timeAdjust, $limit) use ($restaurant, $menu, $ignoreMenuTime) {
$counter = 0;
while ($this->getIsClosedAtTime($restaurant, $selectedTime, $menu, false, $ignoreMenuTime)) {
$selectedTime = strtotime($timeAdjust, $selectedTime);
if ($counter >= $limit) {
break;
}
$counter++;
}
return $selectedTime;
};
//going forward by each hour, check for an open time
$selectedTime = $findOpenTime($selectedTime, '+60 Minute', $limit);
//opened sometime in last hour. If open 30 minutes ago, check the 30 before that, otherwise check last 30 minutes
$thrityAgo = strtotime('-30 Minute', $selectedTime);
if (!$this->getIsClosedAtTime($restaurant, $thrityAgo, $menu, false, $ignoreMenuTime)) {
$thrityAgo = strtotime('-60 Minute', $selectedTime);
}
return $findOpenTime($thrityAgo, '+1 Minute', 30);
}
Arguments
Restaurant {}
1773128760
null
false
true
/home
/deploy
/EHungry-11-boyan
/Web
/classes
/Cart.class.php
if (!$this->getIsClosedAtTime($restaurant, $selectedTime, $menu, false, $ignoreMenuTime)) {
return $selectedTime;
}
$limit = $noLimit ? 8736 : 336; //336 = 14 * 24 = 2 weeks / 8736 = 1 year
$findOpenTime = function ($selectedTime, $timeAdjust, $limit) use ($restaurant, $menu, $ignoreMenuTime) {
$counter = 0;
while ($this->getIsClosedAtTime($restaurant, $selectedTime, $menu, false, $ignoreMenuTime)) {
$selectedTime = strtotime($timeAdjust, $selectedTime);
if ($counter >= $limit) {
break;
}
$counter++;
}
return $selectedTime;
};
//going forward by each hour, check for an open time
$selectedTime = $findOpenTime($selectedTime, '+60 Minute', $limit);
//opened sometime in last hour. If open 30 minutes ago, check the 30 before that, otherwise check last 30 minutes
$thrityAgo = strtotime('-30 Minute', $selectedTime);
if (!$this->getIsClosedAtTime($restaurant, $thrityAgo, $menu, false, $ignoreMenuTime)) {
$thrityAgo = strtotime('-60 Minute', $selectedTime);
}
return $findOpenTime($thrityAgo, '+1 Minute', 30);
}
public function getNextOpenTimeForAnyType($restaurant, $time = false) {
$tmpOt = $this->getBaseOrderType();
$nextOpenTime = null;
foreach (CustomerOrder::TYPES_CAMEL as $type => $typeCamel) {
if ($restaurant->{'getHas' . $typeCamel . 'Base'}()) {
$this->setBaseOrderType($type);
$newNextOpenTime = $this->getNextOpenTime($restaurant, $time ?: $restaurant->getLocalTime(), true, true);
$nextOpenTime = !$nextOpenTime || $newNextOpenTime < $nextOpenTime ? $newNextOpenTime : $nextOpenTime;
}
}
$this->setBaseOrderType($tmpOt);
Arguments
1773128760
"+60 Minute"
8736
/home
/deploy
/EHungry-11-boyan
/Web
/classes
/Cart.class.php
};
//going forward by each hour, check for an open time
$selectedTime = $findOpenTime($selectedTime, '+60 Minute', $limit);
//opened sometime in last hour. If open 30 minutes ago, check the 30 before that, otherwise check last 30 minutes
$thrityAgo = strtotime('-30 Minute', $selectedTime);
if (!$this->getIsClosedAtTime($restaurant, $thrityAgo, $menu, false, $ignoreMenuTime)) {
$thrityAgo = strtotime('-60 Minute', $selectedTime);
}
return $findOpenTime($thrityAgo, '+1 Minute', 30);
}
public function getNextOpenTimeForAnyType($restaurant, $time = false) {
$tmpOt = $this->getBaseOrderType();
$nextOpenTime = null;
foreach (CustomerOrder::TYPES_CAMEL as $type => $typeCamel) {
if ($restaurant->{'getHas' . $typeCamel . 'Base'}()) {
$this->setBaseOrderType($type);
$newNextOpenTime = $this->getNextOpenTime($restaurant, $time ?: $restaurant->getLocalTime(), true, true);
$nextOpenTime = !$nextOpenTime || $newNextOpenTime < $nextOpenTime ? $newNextOpenTime : $nextOpenTime;
}
}
$this->setBaseOrderType($tmpOt);
return $nextOpenTime;
}
public function getNextOpenTimeForType($restaurant, $type, $time = false) {
$tmpOt = $this->getBaseOrderType();
$this->setBaseOrderType($type);
$nextOpenTime = $this->getNextOpenTime($restaurant, $time ?: $restaurant->getLocalTime(), true, true);
$this->setBaseOrderType($tmpOt);
return $nextOpenTime;
}
/*public function isItemInOrder($mid = NULL) {
if(!$mid) return false;
$items = $this->getCartItems();
$required_products = explode(',',$mid);
if(is_array($items)) foreach($items as $i) if(is_a($i, 'MenuItem') && in_array($i->getId(), $required_products)) return true;
Arguments
Restaurant {}
1773121560.0
true
true
/home
/deploy
/EHungry-11-boyan
/Web
/templates3.0
/customer
/openstatus.php
$closeDelivery = strtotime($holidayHours->getEndHour());
$closedDelivery = $holidayHours->getIsClosed();
$earliestOpen = !$closedDelivery && (!$earliestOpen || $startDelivery < $earliestOpen) ? $startDelivery : $earliestOpen;
$latestClose = !$closedDelivery && (!$latestClose || $closeDelivery > $latestClose) ? $closeDelivery : $latestClose;
}
if ($restaurant->getTwoHourSets() &&
($restaurant->{"getDelivery".$today."Open2"}() != $restaurant->{"getDelivery".$today."Open"}() ||
$restaurant->{"getDelivery".$today."Closed2"}() != $restaurant->{"getDelivery".$today."Closed"}())) {
$startDelivery2 = strtotime($restaurant->{"getDelivery".$today."Open2"}());
$earliestOpen2 = !$earliestOpen2 || $startDelivery2 < $earliestOpen2 ? $startDelivery2 : $earliestOpen2;
$closeDelivery2 = strtotime($restaurant->{"getDelivery".$today."Closed2"}());
$latestClose2 = !$latestClose2 || $closeDelivery2 > $latestClose2 ? $closeDelivery2 : $latestClose2;
}
}
}
$isOpen = $restaurant->pickupAvailableNow() || $restaurant->deliveryAvailableNow();
if (!$isOpen) {
$nextOpenTime = $cart->getNextOpenTimeForAnyType($restaurant);
}
?>
<div class="open_status">
<span class="open_status_label"><span class="btn btn-sm <?=$isOpen? 'btn-success' :
'btn-danger'?>"><?=$isOpen? 'Open' : 'Closed'?></span>
<? if ($isOpen) { ?>
<? if (($earliestOpen2 && $restaurant->getLocalTime() > $latestClose)) { ?>
<?=date('g:iA', ($earliestOpen2)) . ' - ' . date('g:iA', ($latestClose2))?>
<? } else { ?>
<?=date('g:iA', ($earliestOpen)) . ' - ' . date('g:iA', ($latestClose))?>
<? } ?>
<a href="<?=formatCustomerLink('locationinfo')?>">View Hours</a>
<? } else { ?>
Opens <?=date('l', $nextOpenTime)?> at <?=date('g:iA', ($nextOpenTime))?></span> <a href="<?=formatCustomerLink('locationinfo')?>">View Hours</a>
<? } ?>
<? if ($restaurant->getHoursTextEnabled()) { ?>
<span data-toggle="tooltip" class="opensign-tooltip-trigger" title="<?=$restaurant->getHoursText()?>">
<i class="fas fa-info-circle"></i>
</span>
Arguments
/home
/deploy
/EHungry-11-boyan
/Web
/templates3.0
/customer
/widgets
/openwidget.php
<?
if (!isset($_REQUEST['_TEMPLATE_SETTINGS']['hide_open_sign']) || !$_REQUEST['_TEMPLATE_SETTINGS']['hide_open_sign']->getValue()) {
if (isset($restaurant)) {
$today = date("l");
$holidayDate = date('Y-m-d 00:00:00', $restaurant->getLocalTime()); ?>
<div class="widget sign">
<div class="opensign <?=($restaurant->pickupAvailableNow() || $restaurant->deliveryAvailableNow())?'open':'closed'?>">
<div class="mobile-only">
<? include(CORE_PATH."templates3.0/customer/openstatus.php"); ?>
</div>
<div class="mobile-hidden">
<strong class="h4">
<span><?=($restaurant->pickupAvailableNow() || $restaurant->deliveryAvailableNow())?'Open':'Closed'?></span>
</strong>
</div>
<div class="hours <?=$restaurant->getSeparateDeliveryHours()?'separateHours':''?> mobile-hidden clearfix" id="hoursDiv">
<?
$hasPickupHolidayHours = false;
$hasDeliveryHolidayHours = false;
if ($restaurant->getSeparateDeliveryHours()) {
if ($restaurant->getHasDeliveryBase()) {
$closedDelivery = $restaurant->{"getDeliveryClosedOn".$today}();
$startDelivery = strtotime($restaurant->{"getDelivery".$today."Open"}());
$closeDelivery = strtotime($restaurant->{"getDelivery".$today."Closed"}());
$holidayHours = HolidayHours::getByDateAndRestaurantAndType($holidayDate, $restaurant->getId(), 'DELIVERY');
if (is_object($holidayHours)) {
$startDelivery = strtotime(date('1990-01-01 H:i:00', strtotime($holidayHours->getStartHour())));
$closeDelivery = strtotime(date('1990-01-01 H:i:00', strtotime($holidayHours->getEndHour())));
$closedDelivery = $holidayHours->getIsClosed();
$hasDeliveryHolidayHours = true;
}
}
}
if ($restaurant->getHasDineInBase() || $restaurant->getHasPickupBase()) {
$start = strtotime($restaurant->{"get".$today."Open"}());
$close = strtotime($restaurant->{"get".$today."Closed"}());
$closed = $restaurant->{"getClosedOn".$today}();
$restaurantType = $restaurant->getHasDineInBase() ? "DINEIN" : "PICKUP";
$holidayHours = HolidayHours::getByDateAndRestaurantAndType($holidayDate, $restaurant->getId(), $restaurantType);
Arguments
"/home/deploy/EHungry-11-boyan/Web/templates3.0/customer/openstatus.php"
/home
/deploy
/EHungry-11-boyan
/Web
/templates3.0
/customer
/footer.php
<!-- End Content -->
<? if ($_REQUEST['_PAGEH2']) { ?>
<h2 class="end"><?=$_REQUEST['_PAGEH2']?></h2>
<? } ?>
</div>
<? if (!isset($hideRightColumn) || $hideRightColumn == false) { ?>
<aside class="rightaside">
<? if (!$_REQUEST['mobiledetect']->isMobile() || $_REQUEST['mobiledetect']->isTablet()) {
include(CORE_PATH."templates3.0/customer/widgets/openwidget.php");
include(CORE_PATH."templates3.0/customer/widgets/announcementwidget.php");
}
//if coupon box not hidden
if (is_object($_REQUEST['_TEMPLATE_SETTINGS']['hide_coupons_box']) && !$_REQUEST['_TEMPLATE_SETTINGS']['hide_coupons_box']->getValue()
&& (
(isset($showCart) && $showCart) //show on pages where cart is shown
|| (is_object($_REQUEST['_TEMPLATE_SETTINGS']['show_coupons_display_box_homepage']) && $_REQUEST['_TEMPLATE_SETTINGS']['show_coupons_display_box_homepage']->getValue() && $_REQUEST['form'] == 'home') //show on homepage when enabled
)
) {
$totalCouponsToDisplay = 5;
// We grab 6 coupons with no offset. Even though we are displaying only 5, we grab 6
// to determine whether we should show a "Load More" button
$coupons_in_box = Coupon::getAllCouponsInBoxForAccount($account->getId(), true, false, $totalCouponsToDisplay + 1, 0);
if ($coupons_in_box) {
$couponsDisplayed = 0; // keeps track of how many coupons have been displayed ?>
<div class="widget couponbox">
<header><span class="h3 sep">Coupons</span></header>
<div class="inner clearfix">
<ul id="coupon-list">
<? foreach ($coupons_in_box as $coupon) {
// If we have shown all the coupons we were going to show, we are done
if ($couponsDisplayed == $totalCouponsToDisplay) {
break;
} ?>
<li>
<a href="<?=formatCustomerLink('mycoupons', ['redeem' => $coupon->getId()])?>">
<span class="desc"><?=$coupon->getBriefCouponDescription()?></span>
Arguments
"/home/deploy/EHungry-11-boyan/Web/templates3.0/customer/widgets/openwidget.php"
/home
/deploy
/EHungry-11-boyan
/Web
/controllers
/customer.php
$tab = MainNavigationTab::getAllForAccount($account->getId());
include_once(CORE_PATH.'lib/helpers/customer3.0.php');
if (!in_array($_REQUEST['form'], $viewContentOnly)) {
App::debugbarTime('header');
include_once(getLayoutPartPath('header'));
App::debugbarTime('header');
}
App::debugbarTime("view '{$_REQUEST['form']}'");
$path = CORE_PATH.'view' . ($_REQUEST['_VERSION'] == 4 ? 4 : 3) . '.0/customer/'.$_REQUEST['form'].'.php';
if (is_readable($path)) {
include_once($path);
}
App::debugbarTime("view '{$_REQUEST['form']}'");
if (!in_array($_REQUEST['form'], $viewContentOnly)) {
App::debugbarTime('footer');
include_once(getLayoutPartPath('footer'));
App::debugbarTime('footer');
}
function getLayoutPartPath($part) {
if (isset($_REQUEST['_CORDOVA_APP']) && $_REQUEST['_VERSION'] != 4) {
$cart = Cart::getCurrent();
//FIXME: it's technically possible to end up with $template = null
if (!$_REQUEST['contentonly']) {
$template = !isset($_REQUEST["altdoc"])? "app/$part" : "app/alt$part";
}
} else {
$template = !isset($_REQUEST["altdoc"])? "customer/$part" : "customer/alt$part";
}
if ($_REQUEST['_VERSION'] == 4) {
return CORE_PATH."templates4.0/$template.php";
} else {
return CORE_PATH."templates3.0/$template.php";
}
Arguments
"/home/deploy/EHungry-11-boyan/Web/templates3.0/customer/footer.php"
/home
/deploy
/EHungry-11-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-11-boyan/Web/controllers/customer.php"