/home
/deploy
/EHungry-2-joel
/Web
/classes
/Restaurant.class.php
return false;
}
break;
case PAYMENT_CREDIT:
case PAYMENT_DEBIT:
case PAYMENT_PREPAID:
case PAYMENT_UNKNOWN_CARD:
case PAYMENT_APPLE_PAY:
case PAYMENT_GOOGLE_PAY:
if (!($this->pay_with_credit & @constant($cart->getBaseOrderType()))) {
return false;
}
//if mercury/vantiv and adding new card
if ($account->getEffectivePaymentProcessorId() == PaymentProcessor\Vantiv::$processorId && $handler->params['credit~card'] == -1) {
return true;
}
//Google Pay (Authorize.net and CardConnect)
<<<<<<< HEAD
if ((!empty($handler->params['googlePayToken']) || !empty($handler->params['applePayToken'])) && $account->canUseDigitalWallets()) {
=======
if (!empty($handler->params['google~pay~token']) && $account->canUseGooglePay()) {
>>>>>>> origin/Release/PHP7
return true;
}
$card = new CustomerPaymentInfo($handler->params['credit~card']);
//credit card must match the delivery address it was created for
if ($cart->getBaseOrderType() == 'DELIVERY'
&& ($card->delivery_address_id && $card->delivery_address_id != $cart->getDeliveryAddressId())
&& ($card->delivery_address_id != -1 || $card->saved)) {
return false;
}
$cardTypeName = $card->getShortTypeName();
$cart->setHouseAccountId(null);
$cart->setCustomPaymentTypeId(null);
Arguments
"syntax error, unexpected '<<' (T_SL), expecting case (T_CASE) or default (T_DEFAULT) or '}'"
/home
/deploy
/EHungry-2-joel
/PHP
/vendor
/composer
/ClassLoader.php
*/
public function unregister()
{
spl_autoload_unregister(array($this, 'loadClass'));
if (null !== $this->vendorDir) {
unset(self::$registeredLoaders[$this->vendorDir]);
}
}
/**
* Loads the given class or interface.
*
* @param string $class The name of the class
* @return true|null True if loaded, null otherwise
*/
public function loadClass($class)
{
if ($file = $this->findFile($class)) {
includeFile($file);
return true;
}
return null;
}
/**
* Finds the path to the file where the class is defined.
*
* @param string $class The name of the class
*
* @return string|false The path if found, false otherwise
*/
public function findFile($class)
{
// class map lookup
if (isset($this->classMap[$class])) {
return $this->classMap[$class];
}
Arguments
"/home/deploy/EHungry-2-joel/PHP/vendor/composer/../../../Web/classes/Restaurant.class.php"
/home
/deploy
/EHungry-2-joel
/Web
/classes
/Account.class.php
if (is_array($restaurants)) {
return count($restaurants);
}
return 0;
}
/**
* All restaurants for the given account which are not deleted and, optionally, not locked ($activeOnly)
* @param int $aid
* @param string $orderBy One of: position, id, display_name
* @param bool $activeOnly
* @return Restaurant[]|null
* @see Restaurant::clearCacheByAccountId() so you can clean up the cache keys
*/
public static function getAllRestaurantsByAccountId($aid, $orderBy = 'display_name', $activeOnly = false) {
$cacheKey = "restaurants_{$aid}_{$orderBy}_".($activeOnly? 1 : 0);
return Cache::RememberArray($cacheKey, function () use ($aid, $orderBy, $activeOnly) {
$list = Restaurant::isDeleted(false)->where('account_id', $aid);
if ($activeOnly) {
$list->where('is_locked', false);
}
if (in_array($orderBy, ['position', 'id', 'display_name'])) {
$list->orderBy($orderBy);
}
return $list->get()->all()?: null;
}, true);
}
/**
* All restaurants for the current account which are not deleted and, optionally, not locked ($activeOnly)
* @param string $orderBy One of: position, id, display_name
* @param bool $activeOnly
* @return Restaurant[]|null
*/
public function getAllRestaurants($orderBy = 'display_name', $activeOnly = false) {
return self::getAllRestaurantsByAccountId($this->id, $orderBy, $activeOnly);
}
Arguments
/home
/deploy
/EHungry-2-joel
/Web
/classes
/Cache.class.php
}
private static function RememberType($type, $allowNull, $key, callable $generator, $expire = 86400) {
if (!static::getInstance()) {
return false;
}
if ($type) {
$notFound = $type == 'bool'? null : false;
$value = static::GetType($type, $key, $allowNull, $notFound);
if ($value !== $notFound) {
return $value;
}
} else {
if ($value = static::Get($key)) {
return $value;
}
}
$value = $generator();
if (is_null($value) && !$allowNull) { //skips saving a null value if these are forbidden
return null;
}
static::Set($key, $type? serialize($value) : $value, $expire);
return $value;
}
/**
* If the value for $key is not found, it's generated using $generator and then, stored for further uses.
* @param string $key
* @param callable $generator
* @param int $expire
* @return array|bool|mixed|string
*/
public static function Remember($key, callable $generator, $expire = 86400) {
return static::RememberType(null, null, $key, $generator, $expire);
}
/**
/home
/deploy
/EHungry-2-joel
/Web
/classes
/Cache.class.php
* @param string $key
* @param callable $generator
* @param bool $allowNull
* @param int $expire
* @return null|bool|object
*/
public static function RememberObject($key, callable $generator, $allowNull = false, $expire = 86400) {
return static::RememberType('object', $allowNull, $key, $generator, $expire);
}
/**
* If the value for $key is not found, it's generated using $generator and then, stored for further uses.
* @param string $key
* @param callable $generator
* @param bool $allowNull
* @param int $expire
* @return null|bool|array
*/
public static function RememberArray($key, callable $generator, $allowNull = false, $expire = 86400) {
return static::RememberType('array', $allowNull, $key, $generator, $expire);
}
/**
* If the value for $key is not found, it's generated using $generator and then, stored for further uses.
* @param string $key
* @param callable $generator
* @param int $expire
* @return null|bool
*/
public static function RememberBoolean($key, callable $generator, $expire = 86400) {
return static::RememberType('array', false, $key, $generator, $expire);
}
}
Arguments
"array"
true
"restaurants_77657_display_name_1"
Closure {
class: "Account"
use: {
$aid: 77657
$orderBy: "display_name"
$activeOnly: true
}
}
86400
/home
/deploy
/EHungry-2-joel
/Web
/classes
/Account.class.php
* @param int $aid
* @param string $orderBy One of: position, id, display_name
* @param bool $activeOnly
* @return Restaurant[]|null
* @see Restaurant::clearCacheByAccountId() so you can clean up the cache keys
*/
public static function getAllRestaurantsByAccountId($aid, $orderBy = 'display_name', $activeOnly = false) {
$cacheKey = "restaurants_{$aid}_{$orderBy}_".($activeOnly? 1 : 0);
return Cache::RememberArray($cacheKey, function () use ($aid, $orderBy, $activeOnly) {
$list = Restaurant::isDeleted(false)->where('account_id', $aid);
if ($activeOnly) {
$list->where('is_locked', false);
}
if (in_array($orderBy, ['position', 'id', 'display_name'])) {
$list->orderBy($orderBy);
}
return $list->get()->all()?: null;
}, true);
}
/**
* All restaurants for the current account which are not deleted and, optionally, not locked ($activeOnly)
* @param string $orderBy One of: position, id, display_name
* @param bool $activeOnly
* @return Restaurant[]|null
*/
public function getAllRestaurants($orderBy = 'display_name', $activeOnly = false) {
return self::getAllRestaurantsByAccountId($this->id, $orderBy, $activeOnly);
}
public static function checkIfRestaurantPhoneNumberExistsWithinAReseller($rid, $phone) {
// We start by validating and formatting the given phone number
$pv = new PhoneValidator($phone);
// If the phone number is not valid, we return
if ($phone == '' || !$pv->validate()) {
return '';
}
Arguments
"restaurants_77657_display_name_1"
Closure {
class: "Account"
use: {
$aid: 77657
$orderBy: "display_name"
$activeOnly: true
}
}
true
/home
/deploy
/EHungry-2-joel
/Web
/classes
/Account.class.php
$list = Restaurant::isDeleted(false)->where('account_id', $aid);
if ($activeOnly) {
$list->where('is_locked', false);
}
if (in_array($orderBy, ['position', 'id', 'display_name'])) {
$list->orderBy($orderBy);
}
return $list->get()->all()?: null;
}, true);
}
/**
* All restaurants for the current account which are not deleted and, optionally, not locked ($activeOnly)
* @param string $orderBy One of: position, id, display_name
* @param bool $activeOnly
* @return Restaurant[]|null
*/
public function getAllRestaurants($orderBy = 'display_name', $activeOnly = false) {
return self::getAllRestaurantsByAccountId($this->id, $orderBy, $activeOnly);
}
public static function checkIfRestaurantPhoneNumberExistsWithinAReseller($rid, $phone) {
// We start by validating and formatting the given phone number
$pv = new PhoneValidator($phone);
// If the phone number is not valid, we return
if ($phone == '' || !$pv->validate()) {
return '';
}
// Otherwise, we get the formatted number
$formattedPhone = $pv->getPrettyNumber();
$db_conn = DB::conn();
$sql = "SELECT r.display_name FROM ".Restaurant::getTableName()." AS r INNER JOIN account AS a ON r.account_id = a.id WHERE a.reseller_user_id = ? AND TRIM(r.primary_phone) = ? LIMIT 1";
$db_conn->bindParameter($sql, 1, $rid, "string");
$db_conn->bindParameter($sql, 1, $formattedPhone, "string");
$result = $db_conn->query($sql);
Arguments
77657
"display_name"
true
/home
/deploy
/EHungry-2-joel
/Web
/classes
/Account.class.php
return false;
}
if (!$restaurant->getPublicOrderingIsClosed()) {
return 'ACTIVE';
}
if ($restaurant->getPublicOrderingIsClosedForever()) {
return 'DISABLE';
}
return 'TEMP DISABLE';
}
public function getActiveRestaurants($order_by = 'display_name') {
return $this->getAllRestaurants($order_by, true);
}
public function getRestaurantCount() {
$restaurants = $this->getAllRestaurants('display_name', true);
if (is_array($restaurants)) {
return count($restaurants);
}
return 0;
}
/**
* All restaurants for the given account which are not deleted and, optionally, not locked ($activeOnly)
* @param int $aid
* @param string $orderBy One of: position, id, display_name
* @param bool $activeOnly
* @return Restaurant[]|null
* @see Restaurant::clearCacheByAccountId() so you can clean up the cache keys
*/
public static function getAllRestaurantsByAccountId($aid, $orderBy = 'display_name', $activeOnly = false) {
$cacheKey = "restaurants_{$aid}_{$orderBy}_".($activeOnly? 1 : 0);
return Cache::RememberArray($cacheKey, function () use ($aid, $orderBy, $activeOnly) {
$list = Restaurant::isDeleted(false)->where('account_id', $aid);
Arguments
/home
/deploy
/EHungry-2-joel
/Web
/controllers
/customer.php
if (!$customDomainSet && $_REQUEST['aid'] != $account->getUrlTag()) {
$uri = str_ireplace($_REQUEST['aid'], $account->getUrlTag(), $_SERVER['REQUEST_URI']);
header('Location: '.$uri, true, 301);
exit(0);
}
$_REQUEST['_SINGLE_RESTAURANT'] = false;
//if this is a child group order, we can "import" the restaurant and skip location selection
if (isset($_SESSION['group_order_id'])) {
$restaurant = GroupOrder::find($_SESSION['group_order_id'])->restaurant;
$_REQUEST['_SINGLE_RESTAURANT'] = true;
} elseif (isset($_SESSION['restaurant_id'])) {
$restaurant = new Restaurant($_SESSION['restaurant_id']);
if ($account->getId() != $restaurant->getAccountId()) {
$restaurant = null;
}
}
//if no restaurant chosen, if account only has 1 location, select it
if ($account->getRestaurantCount() == 1) {
$_REQUEST['_SINGLE_RESTAURANT'] = true;
if (!isset($restaurant) || !is_object($restaurant)) {
$restaurant = $account->getDefaultRestaurant();
}
}
if (isset($restaurant) && $restaurant) {
$cart = Cart::clearCurrentIfRestaurantIsDifferent($restaurant);
$_SESSION['restaurant_id'] = $restaurant->getId();
$menus = $restaurant->getActiveMenus();
if (count($menus) == 1) {
$_REQUEST['_SINGLE_MENU'] = true;
}
}
$domain = null;
//must be premium plan
if ($account->hasPermission(WHITELABEL)) {
$domain = CustomDomain::getForAccount($account->getId());
}
/home
/deploy
/EHungry-2-joel
/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-2-joel/Web/controllers/customer.php"