/home
/deploy
/EHungry-9-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-9-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_c178586_wednesday_PICKUP_1"
86400
"N;"
/home
/deploy
/EHungry-9-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
"ch_c178586_wednesday_PICKUP_1"
"N;"
86400
/home
/deploy
/EHungry-9-boyan
/Web
/classes
/ClosedHours.class.php
$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() {
$dayNames = ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday'];
$closedDayNames = [];
foreach ($dayNames as $dayName) {
Arguments
"ch_c178586_wednesday_PICKUP_1"
null
/home
/deploy
/EHungry-9-boyan
/Web
/classes
/ClosedHours.class.php
$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;
case 'DINEIN':
$sql .= " AND dinein=1 ";
break;
}
Arguments
1769052208
-1
178586
"PICKUP"
true
/home
/deploy
/EHungry-9-boyan
/Web
/classes
/ClosedHours.class.php
/**
* @param Restaurant $restaurant
* @param Category $category
* @param $time
* @return bool
*/
public static function isCategoryHidden($restaurant, $category, $time = null) {
return self::isCategoryDisabled($restaurant, $category, $time, true);
}
public static function isCategoryDisabled($restaurant, $category, $time = null, $isHiddenToCustomers = false, $orderType = null) {
if (!$orderType) {
$cart = Cart::getCurrent();
$orderType = $cart->getBaseOrderType();
}
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);
}
Arguments
1769052208
178586
null
true
/home
/deploy
/EHungry-9-boyan
/Web
/classes
/ClosedHours.class.php
$ch->loadFromArray($row, true);
$rbs[$row['id']] = $ch;
}
return $rbs;
}
return null;
}
public static function getAllForRestaurant($rid = -1) {
return self::getAllForRestaurantOrCategory($rid, -1);
}
/**
* @param Restaurant $restaurant
* @param Category $category
* @param $time
* @return bool
*/
public static function isCategoryHidden($restaurant, $category, $time = null) {
return self::isCategoryDisabled($restaurant, $category, $time, true);
}
public static function isCategoryDisabled($restaurant, $category, $time = null, $isHiddenToCustomers = false, $orderType = null) {
if (!$orderType) {
$cart = Cart::getCurrent();
$orderType = $cart->getBaseOrderType();
}
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;
}
Arguments
Restaurant {}
Category {}
1769052208
true
/home
/deploy
/EHungry-9-boyan
/Web
/classes
/Category.class.php
if ($imageURL !== null) {
Cache::Set('category_image_'.$this->id, $imageURL);
}
return $imageURL;
}
/**
* Returns categories without those are hidden by holiday hours & closed hours
* @param int $rid restaurant id
* @param array $categories
* @return array
*/
public static function removeHiddenCategoriesFromArray($rid, $categories) {
if (is_array($categories)) {
$restaurant = new Restaurant($rid);
$filteredCategories = [];
foreach ($categories as $category) {
$isHidden = HolidayHours::isCategoryHidden($restaurant, $category) || ClosedHours::isCategoryHidden($restaurant, $category);
if (!$isHidden) {
$filteredCategories[] = $category;
}
}
return $filteredCategories;
}
return [];
}
public function getNewUrlTag() {
$originalTag = $urlTag = preg_replace('/[^a-zA-Z0-9_\-]/', '', preg_replace('/\s/', '-', mb_strtolower($this->display_name)));
$count = 1;
$tagObject = Category::getByAccountAndUrlTag($this->account_id, $urlTag);
while (is_object($tagObject) && $tagObject->id != $this->id) {
$urlTag = $originalTag.'-'.$count++;
$tagObject = Category::getByAccountAndUrlTag($this->account_id, $urlTag);
}
return $urlTag;
}
Arguments
Restaurant {}
Category {}
/home
/deploy
/EHungry-9-boyan
/Web
/classes
/Menu.class.php
$sql = "SELECT DISTINCT b.* FROM ".RestaurantCategory::getTableName()." a INNER JOIN ".Category::getTableName()." b ON a.menu_category_id = b.id
LEFT JOIN ".Category::getTableName()." p ON p.id = b.parent_id
WHERE b.menu_id = ? AND a.restaurant_id = ? AND b.is_shown = 1 AND (p.is_shown = 1 OR b.is_parent = 1) ORDER BY ";
if ($alphabetical) {
$sql .= "b.display_name ASC";
} else {
$sql .= "priority";
}
$db_conn->bindParameter($sql, 1, $this->getId(), "integer");
$db_conn->bindParameter($sql, 1, $rid, "integer");
$result = $db_conn->query($sql);
if ($result && $result->rowCount() > 0) {
while ($row = $result->fetch()) {
$c = new Category();
$c->loadFromArray($row, true);
$arr[] = $c;
}
if (count($arr)) {
Cache::SetArray($cacheKey, $arr);
return Category::removeHiddenCategoriesFromArray($rid, $arr);
}
}
Cache::SetArray($cacheKey, null);
return null;
}
public function deleteWithDependencies() {
MenuRestaurant::where('menu_id', $this->getId())->delete();
MenuRestaurant::clearCacheByMenu($this);
foreach ($this->categories as $category) {
//if category is the parent, check for children and promote one to parent
if ($category->getIsParent() == 1) {
$parentId = false;
$children = Category::getAllByParent($category->getId());
if (is_array($children) && count($children) > 0) {
foreach ($children as $c) {
if ($parentId === false) {
$c->setIsParent(true);
$c->setParentId(0);
Arguments
11127
array:22 [
0 => Category {}
1 => Category {}
2 => Category {}
3 => Category {}
4 => Category {}
5 => Category {}
6 => Category {}
7 => Category {}
8 => Category {}
9 => Category {}
10 => Category {}
11 => Category {}
12 => Category {}
13 => Category {}
14 => Category {}
15 => Category {}
16 => Category {}
17 => Category {}
18 => Category {}
19 => Category {}
20 => Category {}
21 => Category {}
]
/home
/deploy
/EHungry-9-boyan
/Web
/controllers
/customer.php
if (is_array($bagTypes) && count($bagTypes)) {
$defaultBagType = RestaurantBagType::getDefaultBagType($bagTypes);
$selectedBagType = $defaultBagType?: $bagTypes[0];
$numberOfBags = $restaurant->bags_formula_enabled ? ceil($restaurant->bags_formula_count_per_price * $cart->getSubTotal() / $restaurant->bags_formula_price) : 1;
$cart->setBagsType($selectedBagType->id);
$cart->setBagsTypeName($selectedBagType->display_name);
$cart->bags_price = $selectedBagType->price;
$cart->bags_fee_total = $numberOfBags*$selectedBagType->price;
}
} elseif ($_SESSION['saved_state_bag~type']) {
$cart->setBagsType($_SESSION['saved_state_bag~type']);
}
}
} else {
unset($_SESSION['menu_id']);
}
// load the categories for the selected menu
if (isset($restaurant) && is_object($restaurant) && isset($menu) && is_object($menu)) {
$categories = $menu->getCategoriesForRestaurant($restaurant->getId(), true);
}
if (array_key_exists($_REQUEST['form'], $pageTitles)) {
$_REQUEST['_PAGETITLE'] = $pageTitles[$_REQUEST['form']];
} else if (!isset($_REQUEST['_PAGETITLE'])) {
$_REQUEST['_PAGETITLE'] = ucfirst(strtolower($_REQUEST['form']));
}
if (array_key_exists($_REQUEST['form'], $pageMetaDescription)) {
$_REQUEST['_PAGEDESCRIPTION'] = $pageMetaDescription[$_REQUEST['form']];
}
App::debugbarTime("model '{$_REQUEST['form']}'");
$modelPath = CORE_PATH . 'model3.0/customer/'.$_REQUEST['form'].'.php';
if ($_REQUEST['_VERSION'] == 4) {
//set default order type
$selectedRestaurant = $restaurant;
if (!isset($restaurant)) {
$restaurant = $account->getDefaultRestaurant();
}
if ($restaurant) {
Arguments
/home
/deploy
/EHungry-9-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-9-boyan/Web/controllers/customer.php"